зеркало из https://github.com/mozilla/pjs.git
[minimo only] Minimo, the app, lives -- inital checkin
This commit is contained in:
Родитель
3c5536d524
Коммит
54a8922b98
|
@ -42,7 +42,7 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = chromelite
|
||||
DIRS = chromelite app
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Mozilla browser.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Christopher
|
||||
# Blizzard. Portions created by Christopher Blizzard are
|
||||
# Copyright (C) 1999, Mozilla. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = minimo
|
||||
REQUIRES = gtkembedmoz \
|
||||
xpcom \
|
||||
string \
|
||||
dom \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = Minimo.cpp
|
||||
|
||||
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
|
||||
|
||||
LIBS += \
|
||||
-lgtkembedmoz \
|
||||
$(XLDFLAGS) \
|
||||
$(XLIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
FINAL_LINK_COMPS=$(topsrcdir)/embedding/minimo/app/minimo-link-comps
|
||||
|
||||
include $(topsrcdir)/config/static-config.mk
|
||||
|
||||
EXTRA_DEPS += $(STATIC_EXTRA_DEPS)
|
||||
EXTRA_DSO_LIBS += $(STATIC_EXTRA_DSO_LIBS)
|
||||
|
||||
EXTRA_LIBS += -L$(DEPTH)/dist/lib/components \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
$(STATIC_EXTRA_LIBS) \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
-lSM -lICE \
|
||||
$(TK_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
|
||||
|
||||
|
|
@ -0,0 +1,984 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Christopher Blizzard.
|
||||
* Portions created by Christopher Blizzard are Copyright (C)
|
||||
* Christopher Blizzard. All Rights Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Christopher Blizzard <blizzard@mozilla.org>
|
||||
* Doug Turner <dougt@meer.net> Branched from TestGtkEmbed.cpp
|
||||
*/
|
||||
|
||||
#include "icons.h"
|
||||
#include "gtkmozembed.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// mozilla specific headers
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "prenv.h"
|
||||
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
#include "nsTraceMalloc.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_JPROF
|
||||
#include "jprof.h"
|
||||
#endif
|
||||
|
||||
#define MINIMO_HOME_URL "http://www.mozilla.org/projects/minimo/home.html"
|
||||
|
||||
typedef struct _TestGtkBrowser {
|
||||
GtkWidget *topLevelWindow;
|
||||
GtkWidget *topLevelVBox;
|
||||
GtkWidget *toolbarHBox;
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *backButton;
|
||||
GtkWidget *stopButton;
|
||||
GtkWidget *forwardButton;
|
||||
GtkWidget *reloadButton;
|
||||
GtkWidget *homeButton;
|
||||
GtkWidget *urlEntry;
|
||||
GtkWidget *mozEmbed;
|
||||
GtkWidget *progressAreaHBox;
|
||||
GtkWidget *progressBar;
|
||||
GtkWidget *statusAlign;
|
||||
GtkWidget *statusBar;
|
||||
GtkWidget *backIcon;
|
||||
GtkWidget *forwardIcon;
|
||||
GtkWidget *homeIcon;
|
||||
GtkWidget *reloadIcon;
|
||||
GtkWidget *stopIcon;
|
||||
const char *statusMessage;
|
||||
int loadPercent;
|
||||
int bytesLoaded;
|
||||
int maxBytesLoaded;
|
||||
char *tempMessage;
|
||||
gboolean toolBarOn;
|
||||
gboolean locationBarOn;
|
||||
gboolean statusBarOn;
|
||||
|
||||
} TestGtkBrowser;
|
||||
|
||||
// the list of browser windows currently open
|
||||
GList *browser_list = g_list_alloc();
|
||||
|
||||
static TestGtkBrowser *new_gtk_browser (guint32 chromeMask);
|
||||
static void set_browser_visibility (TestGtkBrowser *browser,
|
||||
gboolean visibility);
|
||||
|
||||
static int num_browsers = 0;
|
||||
|
||||
// callbacks from the UI
|
||||
static void back_clicked_cb (GtkButton *button,
|
||||
TestGtkBrowser *browser);
|
||||
static void stop_clicked_cb (GtkButton *button,
|
||||
TestGtkBrowser *browser);
|
||||
static void forward_clicked_cb (GtkButton *button,
|
||||
TestGtkBrowser *browser);
|
||||
static void reload_clicked_cb (GtkButton *button,
|
||||
TestGtkBrowser *browser);
|
||||
static void home_clicked_cb (GtkButton *button,
|
||||
TestGtkBrowser *browser);
|
||||
static void url_activate_cb (GtkEditable *widget,
|
||||
TestGtkBrowser *browser);
|
||||
static gboolean delete_cb (GtkWidget *widget, GdkEventAny *event,
|
||||
TestGtkBrowser *browser);
|
||||
static void destroy_cb (GtkWidget *widget,
|
||||
TestGtkBrowser *browser);
|
||||
|
||||
// callbacks from the widget
|
||||
static void location_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static void title_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static void load_started_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static void load_finished_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static void net_state_change_cb (GtkMozEmbed *embed, gint flags,
|
||||
guint status, TestGtkBrowser *browser);
|
||||
static void net_state_change_all_cb (GtkMozEmbed *embed, const char *uri,
|
||||
gint flags, guint status,
|
||||
TestGtkBrowser *browser);
|
||||
static void progress_change_cb (GtkMozEmbed *embed, gint cur, gint max,
|
||||
TestGtkBrowser *browser);
|
||||
static void progress_change_all_cb (GtkMozEmbed *embed, const char *uri,
|
||||
gint cur, gint max,
|
||||
TestGtkBrowser *browser);
|
||||
static void link_message_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static void js_status_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static void new_window_cb (GtkMozEmbed *embed,
|
||||
GtkMozEmbed **retval, guint chromemask,
|
||||
TestGtkBrowser *browser);
|
||||
static void visibility_cb (GtkMozEmbed *embed,
|
||||
gboolean visibility,
|
||||
TestGtkBrowser *browser);
|
||||
static void destroy_brsr_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static gint open_uri_cb (GtkMozEmbed *embed, const char *uri,
|
||||
TestGtkBrowser *browser);
|
||||
static void size_to_cb (GtkMozEmbed *embed, gint width,
|
||||
gint height, TestGtkBrowser *browser);
|
||||
static gint dom_key_down_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event,
|
||||
TestGtkBrowser *browser);
|
||||
static gint dom_key_press_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event,
|
||||
TestGtkBrowser *browser);
|
||||
static gint dom_key_up_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event,
|
||||
TestGtkBrowser *browser);
|
||||
static gint dom_mouse_down_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser);
|
||||
static gint dom_mouse_up_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser);
|
||||
static gint dom_mouse_click_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser);
|
||||
static gint dom_mouse_dbl_click_cb (GtkMozEmbed *embed,
|
||||
nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser);
|
||||
static gint dom_mouse_over_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser);
|
||||
static gint dom_mouse_out_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser);
|
||||
|
||||
// callbacks from the singleton object
|
||||
static void new_window_orphan_cb (GtkMozEmbedSingle *embed,
|
||||
GtkMozEmbed **retval, guint chromemask,
|
||||
gpointer data);
|
||||
|
||||
// some utility functions
|
||||
static void update_status_bar_text (TestGtkBrowser *browser);
|
||||
static void update_temp_message (TestGtkBrowser *browser,
|
||||
const char *message);
|
||||
static void update_nav_buttons (TestGtkBrowser *browser);
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
argc = NS_TraceMallocStartupArgs(argc, argv);
|
||||
#endif
|
||||
|
||||
gtk_set_locale();
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
#ifdef MOZ_JPROF
|
||||
setupProfilingStuff();
|
||||
#endif
|
||||
|
||||
char *home_path;
|
||||
char *full_path;
|
||||
home_path = PR_GetEnv("HOME");
|
||||
if (!home_path) {
|
||||
fprintf(stderr, "Failed to get HOME\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
full_path = g_strdup_printf("%s/%s", home_path, ".TestGtkEmbed");
|
||||
|
||||
gtk_moz_embed_set_profile_path(full_path, "TestGtkEmbed");
|
||||
|
||||
TestGtkBrowser *browser = new_gtk_browser(GTK_MOZ_EMBED_FLAG_DEFAULTCHROME);
|
||||
|
||||
// set our minimum size
|
||||
gtk_widget_set_usize(browser->mozEmbed, 240, 320);
|
||||
|
||||
set_browser_visibility(browser, TRUE);
|
||||
|
||||
if (argc > 1)
|
||||
gtk_moz_embed_load_url(GTK_MOZ_EMBED(browser->mozEmbed), argv[1]);
|
||||
|
||||
// get the singleton object and hook up to its new window callback
|
||||
// so we can create orphaned windows.
|
||||
|
||||
GtkMozEmbedSingle *single;
|
||||
|
||||
single = gtk_moz_embed_single_get();
|
||||
if (!single) {
|
||||
fprintf(stderr, "Failed to get singleton embed object!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(single), "new_window_orphan",
|
||||
GTK_SIGNAL_FUNC(new_window_orphan_cb), NULL);
|
||||
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
NewIconFromXPM(GtkWidget *toolbar, gchar** icon_xpm)
|
||||
{
|
||||
GdkBitmap *mask;
|
||||
GdkColormap *colormap = gtk_widget_get_colormap(toolbar);
|
||||
GtkStyle *style = gtk_widget_get_style(toolbar);
|
||||
|
||||
GdkPixmap *pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL,
|
||||
colormap,
|
||||
&mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
icon_xpm);
|
||||
GtkWidget* icon = gtk_pixmap_new(pixmap, mask);
|
||||
return icon;
|
||||
}
|
||||
|
||||
static TestGtkBrowser *
|
||||
new_gtk_browser(guint32 chromeMask)
|
||||
{
|
||||
guint32 actualChromeMask = chromeMask;
|
||||
TestGtkBrowser *browser = 0;
|
||||
|
||||
num_browsers++;
|
||||
|
||||
browser = g_new0(TestGtkBrowser, 1);
|
||||
|
||||
browser_list = g_list_prepend(browser_list, browser);
|
||||
|
||||
browser->toolBarOn = FALSE;
|
||||
browser->locationBarOn = FALSE;
|
||||
browser->statusBarOn = FALSE;
|
||||
|
||||
g_print("new_gtk_browser\n");
|
||||
|
||||
if (chromeMask == GTK_MOZ_EMBED_FLAG_DEFAULTCHROME)
|
||||
actualChromeMask = GTK_MOZ_EMBED_FLAG_ALLCHROME;
|
||||
|
||||
if (actualChromeMask & GTK_MOZ_EMBED_FLAG_TOOLBARON)
|
||||
{
|
||||
browser->toolBarOn = TRUE;
|
||||
g_print("\ttool bar\n");
|
||||
}
|
||||
if (actualChromeMask & GTK_MOZ_EMBED_FLAG_LOCATIONBARON)
|
||||
{
|
||||
browser->locationBarOn = TRUE;
|
||||
g_print("\tlocation bar\n");
|
||||
}
|
||||
if (actualChromeMask & GTK_MOZ_EMBED_FLAG_STATUSBARON)
|
||||
{
|
||||
browser->statusBarOn = TRUE;
|
||||
g_print("\tstatus bar\n");
|
||||
}
|
||||
|
||||
// create our new toplevel window
|
||||
browser->topLevelWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
// new vbox
|
||||
browser->topLevelVBox = gtk_vbox_new(FALSE, 0);
|
||||
// add it to the toplevel window
|
||||
gtk_container_add(GTK_CONTAINER(browser->topLevelWindow),
|
||||
browser->topLevelVBox);
|
||||
|
||||
// create the hbox that will contain the toolbar and the url text entry bar
|
||||
browser->toolbarHBox = gtk_hbox_new(false, 0);
|
||||
// add that hbox to the vbox
|
||||
gtk_box_pack_start(GTK_BOX(browser->topLevelVBox),
|
||||
browser->toolbarHBox,
|
||||
FALSE, // expand
|
||||
FALSE, // fill
|
||||
0); // padding
|
||||
// new horiz toolbar with buttons + icons
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
browser->toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,
|
||||
GTK_TOOLBAR_ICONS);
|
||||
#endif /* MOZ_WIDGET_GTK */
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
browser->toolbar = gtk_toolbar_new();
|
||||
gtk_toolbar_set_orientation(GTK_TOOLBAR(browser->toolbar),
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(browser->toolbar),
|
||||
GTK_TOOLBAR_ICONS);
|
||||
#endif /* MOZ_WIDGET_GTK2 */
|
||||
|
||||
|
||||
// setup the icons
|
||||
browser->backIcon = NewIconFromXPM(browser->toolbar, back_xpm);
|
||||
browser->forwardIcon = NewIconFromXPM(browser->toolbar, forward_xpm);
|
||||
browser->homeIcon = NewIconFromXPM(browser->toolbar, home_xpm);
|
||||
browser->reloadIcon = NewIconFromXPM(browser->toolbar, reload_xpm);
|
||||
browser->stopIcon = NewIconFromXPM(browser->toolbar, stop_xpm);
|
||||
|
||||
// add it to the hbox
|
||||
gtk_box_pack_start(GTK_BOX(browser->toolbarHBox), browser->toolbar,
|
||||
FALSE, // expand
|
||||
FALSE, // fill
|
||||
0); // padding
|
||||
// new back button
|
||||
browser->backButton =
|
||||
gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),
|
||||
"Back",
|
||||
"Go Back",
|
||||
"Go Back",
|
||||
browser->backIcon,
|
||||
GTK_SIGNAL_FUNC(back_clicked_cb),
|
||||
browser);
|
||||
// new forward button
|
||||
browser->forwardButton =
|
||||
gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),
|
||||
"Forward",
|
||||
"Forward",
|
||||
"Forward",
|
||||
browser->forwardIcon,
|
||||
GTK_SIGNAL_FUNC(forward_clicked_cb),
|
||||
browser);
|
||||
// new stop button
|
||||
browser->stopButton =
|
||||
gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),
|
||||
"Stop",
|
||||
"Stop",
|
||||
"Stop",
|
||||
browser->stopIcon,
|
||||
GTK_SIGNAL_FUNC(stop_clicked_cb),
|
||||
browser);
|
||||
// new reload button
|
||||
browser->reloadButton =
|
||||
gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),
|
||||
"Reload",
|
||||
"Reload",
|
||||
"Reload",
|
||||
browser->reloadIcon,
|
||||
GTK_SIGNAL_FUNC(reload_clicked_cb),
|
||||
browser);
|
||||
// new home button
|
||||
browser->homeButton =
|
||||
gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),
|
||||
"Home",
|
||||
"Home",
|
||||
"Home",
|
||||
browser->homeIcon,
|
||||
GTK_SIGNAL_FUNC(home_clicked_cb),
|
||||
browser);
|
||||
|
||||
// create the url text entry
|
||||
browser->urlEntry = gtk_entry_new();
|
||||
// add it to the hbox
|
||||
gtk_box_pack_start(GTK_BOX(browser->toolbarHBox), browser->urlEntry,
|
||||
TRUE, // expand
|
||||
TRUE, // fill
|
||||
0); // padding
|
||||
// create our new gtk moz embed widget
|
||||
browser->mozEmbed = gtk_moz_embed_new();
|
||||
// add it to the toplevel vbox
|
||||
gtk_box_pack_start(GTK_BOX(browser->topLevelVBox), browser->mozEmbed,
|
||||
TRUE, // expand
|
||||
TRUE, // fill
|
||||
0); // padding
|
||||
// create the new hbox for the progress area
|
||||
browser->progressAreaHBox = gtk_hbox_new(FALSE, 0);
|
||||
|
||||
#if 0
|
||||
// add it to the vbox
|
||||
gtk_box_pack_start(GTK_BOX(browser->topLevelVBox), browser->progressAreaHBox,
|
||||
FALSE, // expand
|
||||
FALSE, // fill
|
||||
0); // padding
|
||||
#endif
|
||||
|
||||
// create our new progress bar
|
||||
browser->progressBar = gtk_progress_bar_new();
|
||||
|
||||
// add it to the hbox
|
||||
gtk_box_pack_start(GTK_BOX(browser->progressAreaHBox), browser->progressBar,
|
||||
FALSE, // expand
|
||||
FALSE, // fill
|
||||
0); // padding
|
||||
|
||||
// create our status area and the alignment object that will keep it
|
||||
// from expanding
|
||||
browser->statusAlign = gtk_alignment_new(0, 0, 1, 1);
|
||||
gtk_widget_set_usize(browser->statusAlign, 1, -1);
|
||||
// create the status bar
|
||||
browser->statusBar = gtk_statusbar_new();
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(browser->statusAlign), browser->statusBar);
|
||||
// add it to the hbox
|
||||
gtk_box_pack_start(GTK_BOX(browser->progressAreaHBox), browser->statusAlign,
|
||||
TRUE, // expand
|
||||
TRUE, // fill
|
||||
0); // padding
|
||||
// by default none of the buttons are marked as sensitive.
|
||||
gtk_widget_set_sensitive(browser->backButton, FALSE);
|
||||
gtk_widget_set_sensitive(browser->stopButton, FALSE);
|
||||
gtk_widget_set_sensitive(browser->forwardButton, FALSE);
|
||||
gtk_widget_set_sensitive(browser->reloadButton, FALSE);
|
||||
|
||||
// catch the destruction of the toplevel window
|
||||
gtk_signal_connect(GTK_OBJECT(browser->topLevelWindow), "delete_event",
|
||||
GTK_SIGNAL_FUNC(delete_cb), browser);
|
||||
|
||||
// hook up the activate signal to the right callback
|
||||
gtk_signal_connect(GTK_OBJECT(browser->urlEntry), "activate",
|
||||
GTK_SIGNAL_FUNC(url_activate_cb), browser);
|
||||
|
||||
// hook up the location change to update the urlEntry
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "location",
|
||||
GTK_SIGNAL_FUNC(location_changed_cb), browser);
|
||||
// hook up the title change to update the window title
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "title",
|
||||
GTK_SIGNAL_FUNC(title_changed_cb), browser);
|
||||
// hook up the start and stop signals
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_start",
|
||||
GTK_SIGNAL_FUNC(load_started_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_stop",
|
||||
GTK_SIGNAL_FUNC(load_finished_cb), browser);
|
||||
// hook up to the change in network status
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state",
|
||||
GTK_SIGNAL_FUNC(net_state_change_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state_all",
|
||||
GTK_SIGNAL_FUNC(net_state_change_all_cb), browser);
|
||||
// hookup to changes in progress
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress",
|
||||
GTK_SIGNAL_FUNC(progress_change_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress_all",
|
||||
GTK_SIGNAL_FUNC(progress_change_all_cb), browser);
|
||||
// hookup to changes in over-link message
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "link_message",
|
||||
GTK_SIGNAL_FUNC(link_message_cb), browser);
|
||||
// hookup to changes in js status message
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "js_status",
|
||||
GTK_SIGNAL_FUNC(js_status_cb), browser);
|
||||
// hookup to see whenever a new window is requested
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "new_window",
|
||||
GTK_SIGNAL_FUNC(new_window_cb), browser);
|
||||
// hookup to any requested visibility changes
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "visibility",
|
||||
GTK_SIGNAL_FUNC(visibility_cb), browser);
|
||||
// hookup to the signal that says that the browser requested to be
|
||||
// destroyed
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy_browser",
|
||||
GTK_SIGNAL_FUNC(destroy_brsr_cb), browser);
|
||||
// hookup to the signal that is called when someone clicks on a link
|
||||
// to load a new uri
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "open_uri",
|
||||
GTK_SIGNAL_FUNC(open_uri_cb), browser);
|
||||
// this signal is emitted when there's a request to change the
|
||||
// containing browser window to a certain height, like with width
|
||||
// and height args for a window.open in javascript
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "size_to",
|
||||
GTK_SIGNAL_FUNC(size_to_cb), browser);
|
||||
// key event signals
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_down",
|
||||
GTK_SIGNAL_FUNC(dom_key_down_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_press",
|
||||
GTK_SIGNAL_FUNC(dom_key_press_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_up",
|
||||
GTK_SIGNAL_FUNC(dom_key_up_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_down",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_down_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_up",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_up_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_click",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_click_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_dbl_click",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_dbl_click_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_over",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_over_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_out",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_out_cb), browser);
|
||||
// hookup to when the window is destroyed
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy",
|
||||
GTK_SIGNAL_FUNC(destroy_cb), browser);
|
||||
|
||||
// set the chrome type so it's stored in the object
|
||||
gtk_moz_embed_set_chrome_mask(GTK_MOZ_EMBED(browser->mozEmbed),
|
||||
actualChromeMask);
|
||||
|
||||
return browser;
|
||||
}
|
||||
|
||||
void
|
||||
set_browser_visibility (TestGtkBrowser *browser, gboolean visibility)
|
||||
{
|
||||
if (!visibility)
|
||||
{
|
||||
gtk_widget_hide(browser->topLevelWindow);
|
||||
return;
|
||||
}
|
||||
|
||||
// since they are on the same line here...
|
||||
if (browser->toolBarOn || browser->locationBarOn)
|
||||
gtk_widget_show_all(browser->toolbarHBox);
|
||||
else
|
||||
gtk_widget_hide_all(browser->toolbarHBox);
|
||||
|
||||
if (browser->statusBarOn)
|
||||
gtk_widget_show_all(browser->progressAreaHBox);
|
||||
else
|
||||
gtk_widget_hide_all(browser->progressAreaHBox);
|
||||
|
||||
gtk_widget_show(browser->mozEmbed);
|
||||
gtk_widget_show(browser->topLevelVBox);
|
||||
gtk_widget_show(browser->topLevelWindow);
|
||||
}
|
||||
|
||||
void
|
||||
back_clicked_cb (GtkButton *button, TestGtkBrowser *browser)
|
||||
{
|
||||
gtk_moz_embed_go_back(GTK_MOZ_EMBED(browser->mozEmbed));
|
||||
}
|
||||
|
||||
void
|
||||
stop_clicked_cb (GtkButton *button, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("stop_clicked_cb\n");
|
||||
gtk_moz_embed_stop_load(GTK_MOZ_EMBED(browser->mozEmbed));
|
||||
}
|
||||
|
||||
void
|
||||
forward_clicked_cb (GtkButton *button, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("forward_clicked_cb\n");
|
||||
gtk_moz_embed_go_forward(GTK_MOZ_EMBED(browser->mozEmbed));
|
||||
}
|
||||
|
||||
void
|
||||
reload_clicked_cb (GtkButton *button, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("reload_clicked_cb\n");
|
||||
GdkModifierType state = (GdkModifierType)0;
|
||||
gint x, y;
|
||||
gdk_window_get_pointer(NULL, &x, &y, &state);
|
||||
|
||||
gtk_moz_embed_reload(GTK_MOZ_EMBED(browser->mozEmbed),
|
||||
(state & GDK_SHIFT_MASK) ?
|
||||
GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE :
|
||||
GTK_MOZ_EMBED_FLAG_RELOADNORMAL);
|
||||
}
|
||||
|
||||
void
|
||||
home_clicked_cb (GtkButton *button, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("home_clicked_cb\n");
|
||||
gtk_moz_embed_load_url(GTK_MOZ_EMBED(browser->mozEmbed), MINIMO_HOME_URL);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
stream_clicked_cb (GtkButton *button, TestGtkBrowser *browser)
|
||||
{
|
||||
const char *data;
|
||||
const char *data2;
|
||||
data = "<html>Hi";
|
||||
data2 = " there</html>\n";
|
||||
g_print("stream_clicked_cb\n");
|
||||
gtk_moz_embed_open_stream(GTK_MOZ_EMBED(browser->mozEmbed),
|
||||
"file://", "text/html");
|
||||
gtk_moz_embed_append_data(GTK_MOZ_EMBED(browser->mozEmbed),
|
||||
data, strlen(data));
|
||||
gtk_moz_embed_append_data(GTK_MOZ_EMBED(browser->mozEmbed),
|
||||
data2, strlen(data2));
|
||||
gtk_moz_embed_close_stream(GTK_MOZ_EMBED(browser->mozEmbed));
|
||||
}
|
||||
|
||||
void
|
||||
url_activate_cb (GtkEditable *widget, TestGtkBrowser *browser)
|
||||
{
|
||||
gchar *text = gtk_editable_get_chars(widget, 0, -1);
|
||||
g_print("loading url %s\n", text);
|
||||
gtk_moz_embed_load_url(GTK_MOZ_EMBED(browser->mozEmbed), text);
|
||||
g_free(text);
|
||||
}
|
||||
void
|
||||
quit_cb (GtkMenuItem *menuitem, TestGtkBrowser *browser)
|
||||
{
|
||||
TestGtkBrowser *tmpBrowser;
|
||||
GList *tmp_list = browser_list;
|
||||
tmpBrowser = (TestGtkBrowser *)tmp_list->data;
|
||||
while (tmpBrowser) {
|
||||
tmp_list = tmp_list->next;
|
||||
gtk_widget_destroy(tmpBrowser->topLevelWindow);
|
||||
tmpBrowser = (TestGtkBrowser *)tmp_list->data;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
delete_cb(GtkWidget *widget, GdkEventAny *event, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("delete_cb\n");
|
||||
gtk_widget_destroy(widget);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
destroy_cb (GtkWidget *widget, TestGtkBrowser *browser)
|
||||
{
|
||||
GList *tmp_list;
|
||||
g_print("destroy_cb\n");
|
||||
num_browsers--;
|
||||
tmp_list = g_list_find(browser_list, browser);
|
||||
browser_list = g_list_remove_link(browser_list, tmp_list);
|
||||
if (browser->tempMessage)
|
||||
g_free(browser->tempMessage);
|
||||
if (num_browsers == 0)
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void
|
||||
location_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser)
|
||||
{
|
||||
char *newLocation;
|
||||
int newPosition = 0;
|
||||
g_print("location_changed_cb\n");
|
||||
newLocation = gtk_moz_embed_get_location(embed);
|
||||
if (newLocation)
|
||||
{
|
||||
gtk_editable_delete_text(GTK_EDITABLE(browser->urlEntry), 0, -1);
|
||||
gtk_editable_insert_text(GTK_EDITABLE(browser->urlEntry),
|
||||
newLocation, strlen(newLocation), &newPosition);
|
||||
g_free(newLocation);
|
||||
}
|
||||
else
|
||||
g_print("failed to get location!\n");
|
||||
// always make sure to clear the tempMessage. it might have been
|
||||
// set from the link before a click and we wouldn't have gotten the
|
||||
// callback to unset it.
|
||||
update_temp_message(browser, 0);
|
||||
// update the nav buttons on a location change
|
||||
update_nav_buttons(browser);
|
||||
}
|
||||
|
||||
void
|
||||
title_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser)
|
||||
{
|
||||
char *newTitle;
|
||||
g_print("title_changed_cb\n");
|
||||
newTitle = gtk_moz_embed_get_title(embed);
|
||||
if (newTitle)
|
||||
{
|
||||
gtk_window_set_title(GTK_WINDOW(browser->topLevelWindow), newTitle);
|
||||
g_free(newTitle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
load_started_cb (GtkMozEmbed *embed, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("load_started_cb\n");
|
||||
gtk_widget_set_sensitive(browser->stopButton, TRUE);
|
||||
gtk_widget_set_sensitive(browser->reloadButton, FALSE);
|
||||
browser->loadPercent = 0;
|
||||
browser->bytesLoaded = 0;
|
||||
browser->maxBytesLoaded = 0;
|
||||
update_status_bar_text(browser);
|
||||
}
|
||||
|
||||
void
|
||||
load_finished_cb (GtkMozEmbed *embed, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("load_finished_cb\n");
|
||||
gtk_widget_set_sensitive(browser->stopButton, FALSE);
|
||||
gtk_widget_set_sensitive(browser->reloadButton, TRUE);
|
||||
browser->loadPercent = 0;
|
||||
browser->bytesLoaded = 0;
|
||||
browser->maxBytesLoaded = 0;
|
||||
update_status_bar_text(browser);
|
||||
gtk_progress_set_percentage(GTK_PROGRESS(browser->progressBar), 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
net_state_change_cb (GtkMozEmbed *embed, gint flags, guint status,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("net_state_change_cb %d\n", flags);
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_IS_REQUEST) {
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_REDIRECTING)
|
||||
browser->statusMessage = "Redirecting to site...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_TRANSFERRING)
|
||||
browser->statusMessage = "Transferring data from site...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_NEGOTIATING)
|
||||
browser->statusMessage = "Waiting for authorization...";
|
||||
}
|
||||
|
||||
if (status == GTK_MOZ_EMBED_STATUS_FAILED_DNS)
|
||||
browser->statusMessage = "Site not found.";
|
||||
else if (status == GTK_MOZ_EMBED_STATUS_FAILED_CONNECT)
|
||||
browser->statusMessage = "Failed to connect to site.";
|
||||
else if (status == GTK_MOZ_EMBED_STATUS_FAILED_TIMEOUT)
|
||||
browser->statusMessage = "Failed due to connection timeout.";
|
||||
else if (status == GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED)
|
||||
browser->statusMessage = "User canceled connecting to site.";
|
||||
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_IS_DOCUMENT) {
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_START)
|
||||
browser->statusMessage = "Loading site...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_STOP)
|
||||
browser->statusMessage = "Done.";
|
||||
}
|
||||
|
||||
update_status_bar_text(browser);
|
||||
|
||||
}
|
||||
|
||||
void net_state_change_all_cb (GtkMozEmbed *embed, const char *uri,
|
||||
gint flags, guint status,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
// g_print("net_state_change_all_cb %s %d %d\n", uri, flags, status);
|
||||
}
|
||||
|
||||
void progress_change_cb (GtkMozEmbed *embed, gint cur, gint max,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("progress_change_cb cur %d max %d\n", cur, max);
|
||||
|
||||
// avoid those pesky divide by zero errors
|
||||
if (max < 1)
|
||||
{
|
||||
gtk_progress_set_activity_mode(GTK_PROGRESS(browser->progressBar), FALSE);
|
||||
browser->loadPercent = 0;
|
||||
browser->bytesLoaded = cur;
|
||||
browser->maxBytesLoaded = 0;
|
||||
update_status_bar_text(browser);
|
||||
}
|
||||
else
|
||||
{
|
||||
browser->bytesLoaded = cur;
|
||||
browser->maxBytesLoaded = max;
|
||||
if (cur > max)
|
||||
browser->loadPercent = 100;
|
||||
else
|
||||
browser->loadPercent = (cur * 100) / max;
|
||||
update_status_bar_text(browser);
|
||||
gtk_progress_set_percentage(GTK_PROGRESS(browser->progressBar), browser->loadPercent / 100.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void progress_change_all_cb (GtkMozEmbed *embed, const char *uri,
|
||||
gint cur, gint max,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
//g_print("progress_change_all_cb %s cur %d max %d\n", uri, cur, max);
|
||||
}
|
||||
|
||||
void
|
||||
link_message_cb (GtkMozEmbed *embed, TestGtkBrowser *browser)
|
||||
{
|
||||
char *message;
|
||||
g_print("link_message_cb\n");
|
||||
message = gtk_moz_embed_get_link_message(embed);
|
||||
if (!message || !*message)
|
||||
update_temp_message(browser, 0);
|
||||
else
|
||||
update_temp_message(browser, message);
|
||||
if (message)
|
||||
g_free(message);
|
||||
}
|
||||
|
||||
void
|
||||
js_status_cb (GtkMozEmbed *embed, TestGtkBrowser *browser)
|
||||
{
|
||||
char *message;
|
||||
g_print("js_status_cb\n");
|
||||
message = gtk_moz_embed_get_js_status(embed);
|
||||
if (!message || !*message)
|
||||
update_temp_message(browser, 0);
|
||||
else
|
||||
update_temp_message(browser, message);
|
||||
if (message)
|
||||
g_free(message);
|
||||
}
|
||||
|
||||
void
|
||||
new_window_cb (GtkMozEmbed *embed, GtkMozEmbed **newEmbed, guint chromemask, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("new_window_cb\n");
|
||||
g_print("embed is %p chromemask is %d\n", (void *)embed, chromemask);
|
||||
TestGtkBrowser *newBrowser = new_gtk_browser(chromemask);
|
||||
gtk_widget_set_usize(newBrowser->mozEmbed, 400, 400);
|
||||
*newEmbed = GTK_MOZ_EMBED(newBrowser->mozEmbed);
|
||||
g_print("new browser is %p\n", (void *)*newEmbed);
|
||||
}
|
||||
|
||||
void
|
||||
visibility_cb (GtkMozEmbed *embed, gboolean visibility, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("visibility_cb %d\n", visibility);
|
||||
set_browser_visibility(browser, visibility);
|
||||
}
|
||||
|
||||
void
|
||||
destroy_brsr_cb (GtkMozEmbed *embed, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("destroy_brsr_cb\n");
|
||||
gtk_widget_destroy(browser->topLevelWindow);
|
||||
}
|
||||
|
||||
gint
|
||||
open_uri_cb (GtkMozEmbed *embed, const char *uri, TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("open_uri_cb %s\n", uri);
|
||||
|
||||
// interrupt this test load
|
||||
if (!strcmp(uri, "http://people.redhat.com/blizzard/monkeys.txt"))
|
||||
return TRUE;
|
||||
// don't interrupt anything
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
size_to_cb (GtkMozEmbed *embed, gint width, gint height,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("*** size_to_cb %d %d\n", width, height);
|
||||
gtk_widget_set_usize(browser->mozEmbed, width, height);
|
||||
}
|
||||
|
||||
gint dom_key_down_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
PRUint32 keyCode = 0;
|
||||
// g_print("dom_key_down_cb\n");
|
||||
event->GetKeyCode(&keyCode);
|
||||
// g_print("key code is %d\n", keyCode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gint dom_key_press_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
PRUint32 keyCode = 0;
|
||||
// g_print("dom_key_press_cb\n");
|
||||
event->GetCharCode(&keyCode);
|
||||
// g_print("char code is %d\n", keyCode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gint dom_key_up_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
PRUint32 keyCode = 0;
|
||||
// g_print("dom_key_up_cb\n");
|
||||
event->GetKeyCode(&keyCode);
|
||||
// g_print("key code is %d\n", keyCode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gint dom_mouse_down_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
// g_print("dom_mouse_down_cb\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gint dom_mouse_up_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
// g_print("dom_mouse_up_cb\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gint dom_mouse_click_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
// g_print("dom_mouse_click_cb\n");
|
||||
PRUint16 button;
|
||||
event->GetButton(&button);
|
||||
printf("button was %d\n", button);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gint dom_mouse_dbl_click_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
// g_print("dom_mouse_dbl_click_cb\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gint dom_mouse_over_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
//g_print("dom_mouse_over_cb\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gint dom_mouse_out_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event,
|
||||
TestGtkBrowser *browser)
|
||||
{
|
||||
//g_print("dom_mouse_out_cb\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void new_window_orphan_cb (GtkMozEmbedSingle *embed,
|
||||
GtkMozEmbed **retval, guint chromemask,
|
||||
gpointer data)
|
||||
{
|
||||
g_print("new_window_orphan_cb\n");
|
||||
g_print("chromemask is %d\n", chromemask);
|
||||
TestGtkBrowser *newBrowser = new_gtk_browser(chromemask);
|
||||
*retval = GTK_MOZ_EMBED(newBrowser->mozEmbed);
|
||||
g_print("new browser is %p\n", (void *)*retval);
|
||||
}
|
||||
|
||||
// utility functions
|
||||
|
||||
void
|
||||
update_status_bar_text(TestGtkBrowser *browser)
|
||||
{
|
||||
gchar message[256];
|
||||
|
||||
gtk_statusbar_pop(GTK_STATUSBAR(browser->statusBar), 1);
|
||||
if (browser->tempMessage)
|
||||
gtk_statusbar_push(GTK_STATUSBAR(browser->statusBar), 1, browser->tempMessage);
|
||||
else
|
||||
{
|
||||
if (browser->loadPercent)
|
||||
{
|
||||
g_snprintf(message, 255, "%s (%d%% complete, %d bytes of %d loaded)", browser->statusMessage, browser->loadPercent, browser->bytesLoaded, browser->maxBytesLoaded);
|
||||
}
|
||||
else if (browser->bytesLoaded)
|
||||
{
|
||||
g_snprintf(message, 255, "%s (%d bytes loaded)", browser->statusMessage, browser->bytesLoaded);
|
||||
}
|
||||
else if (browser->statusMessage == NULL)
|
||||
{
|
||||
g_snprintf(message, 255, " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf(message, 255, "%s", browser->statusMessage);
|
||||
}
|
||||
gtk_statusbar_push(GTK_STATUSBAR(browser->statusBar), 1, message);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
update_temp_message(TestGtkBrowser *browser, const char *message)
|
||||
{
|
||||
if (browser->tempMessage)
|
||||
g_free(browser->tempMessage);
|
||||
if (message)
|
||||
browser->tempMessage = g_strdup(message);
|
||||
else
|
||||
browser->tempMessage = 0;
|
||||
// now that we've updated the temp message, redraw the status bar
|
||||
update_status_bar_text(browser);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
update_nav_buttons (TestGtkBrowser *browser)
|
||||
{
|
||||
gboolean can_go_back;
|
||||
gboolean can_go_forward;
|
||||
can_go_back = gtk_moz_embed_can_go_back(GTK_MOZ_EMBED(browser->mozEmbed));
|
||||
can_go_forward = gtk_moz_embed_can_go_forward(GTK_MOZ_EMBED(browser->mozEmbed));
|
||||
if (can_go_back)
|
||||
gtk_widget_set_sensitive(browser->backButton, TRUE);
|
||||
else
|
||||
gtk_widget_set_sensitive(browser->backButton, FALSE);
|
||||
if (can_go_forward)
|
||||
gtk_widget_set_sensitive(browser->forwardButton, TRUE);
|
||||
else
|
||||
gtk_widget_set_sensitive(browser->forwardButton, FALSE);
|
||||
}
|
||||
|
|
@ -0,0 +1,378 @@
|
|||
/* XPM */
|
||||
static char *back_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 29 1",
|
||||
" c black",
|
||||
". c #2D2D2D",
|
||||
"X c #3B5035",
|
||||
"o c #3C5235",
|
||||
"O c #415639",
|
||||
"+ c #4A6342",
|
||||
"@ c #5B7950",
|
||||
"# c #678C63",
|
||||
"$ c #698267",
|
||||
"% c #7EAB78",
|
||||
"& c #A9C4A7",
|
||||
"* c #AAC5A8",
|
||||
"= c #AAC7A8",
|
||||
"- c #ADC6AB",
|
||||
"; c #AEC7AC",
|
||||
": c #ADC8AB",
|
||||
"> c #B0C7AE",
|
||||
", c #B0C9B0",
|
||||
"< c #B1C9B0",
|
||||
"1 c #B2C9B0",
|
||||
"2 c #B3CAB1",
|
||||
"3 c #B4CBB2",
|
||||
"4 c #B5CEB5",
|
||||
"5 c #B9CEB7",
|
||||
"6 c #BBD0B9",
|
||||
"7 c #BAD1BA",
|
||||
"8 c #CDDECB",
|
||||
"9 c #CFDFCC",
|
||||
"0 c None",
|
||||
/* pixels */
|
||||
"0000000000000000",
|
||||
"0000000 00000000",
|
||||
"000000 00000000",
|
||||
"00000 9 00000000",
|
||||
"0000 82 00",
|
||||
"000 83447462% 00",
|
||||
"00 8=22--=;=$ 00",
|
||||
"0.9:>--=---:# 00",
|
||||
"00 X@@@@@@@@+ 00",
|
||||
"000 X@@XXXXXO 00",
|
||||
"0000 o@ 00",
|
||||
"00000 X 00000000",
|
||||
"000000 00000000",
|
||||
"0000000 00000000",
|
||||
"0000000000000000",
|
||||
"0000000000000000"
|
||||
};
|
||||
|
||||
/* XPM */
|
||||
static char *forward_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 35 1",
|
||||
" c black",
|
||||
". c #0F1308",
|
||||
"X c #445B2C",
|
||||
"o c #43543D",
|
||||
"O c #4D6146",
|
||||
"+ c #506B46",
|
||||
"@ c #5B7950",
|
||||
"# c #65815C",
|
||||
"$ c #6C8562",
|
||||
"% c #6B9060",
|
||||
"& c #709867",
|
||||
"* c #7F9F76",
|
||||
"= c #77A16E",
|
||||
"- c #8DB389",
|
||||
"; c #A6BFA0",
|
||||
": c #A4C3A2",
|
||||
"> c #A5C4A3",
|
||||
", c #A8C6A5",
|
||||
"< c #A9C7A6",
|
||||
"1 c #AAC6A7",
|
||||
"2 c #A8C7A8",
|
||||
"3 c #AAC7A8",
|
||||
"4 c #ABC7A8",
|
||||
"5 c #ABC7AA",
|
||||
"6 c #AEC5A8",
|
||||
"7 c #ACC8A9",
|
||||
"8 c #ADC8AD",
|
||||
"9 c #AEC8AD",
|
||||
"0 c #AFC8AD",
|
||||
"q c #B2CBB0",
|
||||
"w c #BDD3B8",
|
||||
"e c #BFD4BB",
|
||||
"r c #C1D6BD",
|
||||
"t c #C2D7BE",
|
||||
"y c None",
|
||||
/* pixels */
|
||||
"yyyyyyyyyyyyyyyy",
|
||||
"yyyyyyyy yyyyyyy",
|
||||
"yyyyyyyy yyyyyy",
|
||||
"yyyyyyyy = yyyyy",
|
||||
"yy 4& yyyy",
|
||||
"yy rwetttq3&.yyy",
|
||||
"yy 695,,,93>* yy",
|
||||
"yy ;5,,14340>% y",
|
||||
"yy $@@@@@@@@X yy",
|
||||
"yy #+++++@@X yyy",
|
||||
"yy @X yyyy",
|
||||
"yyyyyyyy X yyyyy",
|
||||
"yyyyyyyy yyyyyy",
|
||||
"yyyyyyyy yyyyyyy",
|
||||
"yyyyyyyyyyyyyyyy",
|
||||
"yyyyyyyyyyyyyyyy"
|
||||
};
|
||||
|
||||
/* XPM */
|
||||
static char *stop_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 117 2",
|
||||
" c black",
|
||||
". c #0C0300",
|
||||
"X c #130601",
|
||||
"o c #120703",
|
||||
"O c #180B04",
|
||||
"+ c #361103",
|
||||
"@ c #3A1303",
|
||||
"# c #4B1906",
|
||||
"$ c #4E1A05",
|
||||
"% c #571F06",
|
||||
"& c #54200A",
|
||||
"* c #6D2307",
|
||||
"= c #643119",
|
||||
"- c #67331A",
|
||||
"; c #712407",
|
||||
": c #752707",
|
||||
"> c #7A2807",
|
||||
", c #842C09",
|
||||
"< c #882E0A",
|
||||
"1 c #8F320B",
|
||||
"2 c #8E3A17",
|
||||
"3 c #95360B",
|
||||
"4 c #99370B",
|
||||
"5 c #9E340A",
|
||||
"6 c #9E350B",
|
||||
"7 c #9F350B",
|
||||
"8 c #923A13",
|
||||
"9 c #A1360B",
|
||||
"0 c #A5370B",
|
||||
"q c #A03B0B",
|
||||
"w c #A6380C",
|
||||
"e c #A9390D",
|
||||
"r c #A93A0D",
|
||||
"t c #AD3B0D",
|
||||
"y c #AE3C0D",
|
||||
"u c #AF3E0F",
|
||||
"i c #B13D0D",
|
||||
"p c #B33F0D",
|
||||
"a c #B43F0E",
|
||||
"s c #AA4516",
|
||||
"d c #BC440F",
|
||||
"f c #B14F1F",
|
||||
"g c #BB4512",
|
||||
"h c #BF471B",
|
||||
"j c #B45525",
|
||||
"k c #B75727",
|
||||
"l c #C3470E",
|
||||
"z c #C4480F",
|
||||
"x c #C6480F",
|
||||
"c c #CA4B0F",
|
||||
"v c #C24014",
|
||||
"b c #C64115",
|
||||
"n c #C74316",
|
||||
"m c #C8441F",
|
||||
"M c #CD421C",
|
||||
"N c #CD461E",
|
||||
"B c #CC4C10",
|
||||
"V c #CD4C10",
|
||||
"C c #CE4D10",
|
||||
"Z c #CE4E11",
|
||||
"A c #CA4B1E",
|
||||
"S c #CD4C1F",
|
||||
"D c #D5461F",
|
||||
"F c #DB4B17",
|
||||
"G c #D84D14",
|
||||
"H c #DD4D16",
|
||||
"J c #DD4D17",
|
||||
"K c #D35213",
|
||||
"L c #D75112",
|
||||
"P c #C64B23",
|
||||
"I c #CE4F21",
|
||||
"U c #CE5023",
|
||||
"Y c #CF5328",
|
||||
"T c #D24A25",
|
||||
"R c #D44A25",
|
||||
"E c #D64B25",
|
||||
"W c #D04F2A",
|
||||
"Q c #D24C28",
|
||||
"! c #D64F2A",
|
||||
"~ c #D84723",
|
||||
"^ c #D25225",
|
||||
"/ c #D65320",
|
||||
"( c #D65223",
|
||||
") c #D85323",
|
||||
"_ c #D9522D",
|
||||
"` c #D15C35",
|
||||
"' c #D25E36",
|
||||
"] c #D95C37",
|
||||
"[ c #E05713",
|
||||
"{ c #E15914",
|
||||
"} c #E55913",
|
||||
"| c #E75D17",
|
||||
" . c #E15B19",
|
||||
".. c #C96A41",
|
||||
"X. c #EADDD7",
|
||||
"o. c #F2D9D2",
|
||||
"O. c #F4DDD3",
|
||||
"+. c #F5DED3",
|
||||
"@. c #EAE1DC",
|
||||
"#. c #F0E3DD",
|
||||
"$. c #F6E3DB",
|
||||
"%. c #F5E5DE",
|
||||
"&. c #EFE5E0",
|
||||
"*. c #EEE6E2",
|
||||
"=. c #F5E8E2",
|
||||
"-. c #F5EAE5",
|
||||
";. c #F0EBE8",
|
||||
":. c #F2EDEA",
|
||||
">. c #F7EDE9",
|
||||
",. c #F8EEEA",
|
||||
"<. c #F5F0EE",
|
||||
"1. c #FAF3EF",
|
||||
"2. c #F8F3F1",
|
||||
"3. c gray99",
|
||||
"4. c #FDFDFD",
|
||||
"5. c gray100",
|
||||
"6. c None",
|
||||
/* pixels */
|
||||
"6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.",
|
||||
"6.6.6.6. 6.6.6.6.",
|
||||
"6.6.6. - j L C q % 6.6.6.",
|
||||
"6.6. O j | } L L C z 3 X 6.6.",
|
||||
"6. j { I A H G S P g 1 6.",
|
||||
"6. = .) *.*.Y I @.2.! a $ 6.",
|
||||
"6. s H / #.5.-.:.5.1._ a < 6.",
|
||||
"6. c G F / ,.5.5.O.] D i 0 6.",
|
||||
"6. x V Z I :.5.5.$.` b t 9 6.",
|
||||
"6. 3 x N X.5.O.O.5.>.R e > 6.",
|
||||
"6. % g P o.=.` ..=.>.~ 7 @ 6.",
|
||||
"6. 8 v R E b h W T M ; 6.",
|
||||
"6.6. X 2 u y t e w 7 * . 6.6.",
|
||||
"6.6.6. # , 9 6 : + 6.6.6.",
|
||||
"6.6.6.6. 6.6.6.6.",
|
||||
"6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6."
|
||||
};
|
||||
|
||||
|
||||
/* XPM */
|
||||
static char *reload_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 16 1",
|
||||
" c black",
|
||||
". c #35431B",
|
||||
"X c #50652A",
|
||||
"o c #6B7957",
|
||||
"O c #728E3A",
|
||||
"+ c #7C9B40",
|
||||
"@ c #9BB46F",
|
||||
"# c #9CB476",
|
||||
"$ c #9FA498",
|
||||
"% c #A8AFA0",
|
||||
"& c #B1C491",
|
||||
"* c #BAD09D",
|
||||
"= c #BDD2A1",
|
||||
"- c #CCDCB8",
|
||||
"; c #DEE6D6",
|
||||
": c None",
|
||||
/* pixels */
|
||||
"::::: ::::::::::",
|
||||
"::::: :::::::::",
|
||||
":: % ::::::::",
|
||||
": ;-=* :::::::",
|
||||
": $@++O :::::::",
|
||||
": &X . ::::::::",
|
||||
": # : ::: :::",
|
||||
": o : ::::: ::",
|
||||
": ::::: : ; ::",
|
||||
":: ::: : + ::",
|
||||
"::::::: ; X+ ::",
|
||||
":::::: ;+++X ::",
|
||||
":::::: #+XX ::",
|
||||
"::::::: # :::",
|
||||
":::::::: ::::::",
|
||||
"::::::::: ::::::"
|
||||
};
|
||||
|
||||
/* XPM */
|
||||
static char *home_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 65 1",
|
||||
" c black",
|
||||
". c #0B0E09",
|
||||
"X c #111111",
|
||||
"o c gray8",
|
||||
"O c #191919",
|
||||
"+ c #3D1B14",
|
||||
"@ c gray18",
|
||||
"# c #273122",
|
||||
"$ c #333D2F",
|
||||
"% c #323232",
|
||||
"& c #343434",
|
||||
"* c #393939",
|
||||
"= c #3F3F3F",
|
||||
"- c #354031",
|
||||
"; c #364530",
|
||||
": c #431D15",
|
||||
"> c #50231A",
|
||||
", c #53251B",
|
||||
"< c #57261D",
|
||||
"1 c #612B20",
|
||||
"2 c #763E2F",
|
||||
"3 c #424A40",
|
||||
"4 c gray29",
|
||||
"5 c #465541",
|
||||
"6 c #495545",
|
||||
"7 c #5B5B5B",
|
||||
"8 c #566252",
|
||||
"9 c #586455",
|
||||
"0 c #5B6657",
|
||||
"q c #606060",
|
||||
"w c #656565",
|
||||
"e c gray40",
|
||||
"r c #A54937",
|
||||
"t c #A95849",
|
||||
"y c gray52",
|
||||
"u c #8B8B8B",
|
||||
"i c #979797",
|
||||
"p c #9B9B9B",
|
||||
"a c #AAAAAA",
|
||||
"s c #B4B4B4",
|
||||
"d c gray71",
|
||||
"f c #B6B6B6",
|
||||
"g c #BBBBBB",
|
||||
"h c #BCBCBC",
|
||||
"j c gray77",
|
||||
"k c gray79",
|
||||
"l c #CACACA",
|
||||
"z c gray80",
|
||||
"x c #CECECE",
|
||||
"c c gray81",
|
||||
"v c #D2D2D2",
|
||||
"b c LightGray",
|
||||
"n c gray86",
|
||||
"m c gainsboro",
|
||||
"M c #DFDFDF",
|
||||
"N c gray88",
|
||||
"B c #E2E2E2",
|
||||
"V c #E4E4E4",
|
||||
"C c gray91",
|
||||
"Z c #E9E9E9",
|
||||
"A c #EAEAEA",
|
||||
"S c gray93",
|
||||
"D c #EFEFEF",
|
||||
"F c gray100",
|
||||
"G c None",
|
||||
/* pixels */
|
||||
"GGGGGGGGGGGGGGGG",
|
||||
"GGG G GGGGGGG",
|
||||
"GGG t w7 GGGGGG",
|
||||
"GGG 2 7iAe GGGGG",
|
||||
"GGG X*ulCjp GGGG",
|
||||
"GGG 4pAjAlCy GGG",
|
||||
"GG 4slAlClCxp GG",
|
||||
"G O AlAxC@3& o G",
|
||||
"GGG M><+D*F% GGG",
|
||||
"GGG N,r,S@*@ GGG",
|
||||
"GGG M,r,Vhmh GGG",
|
||||
"GGG B,r<ndvs GGG",
|
||||
"GGG n<<:xhbs GGG",
|
||||
"G 33005;#.86-$6G",
|
||||
"G3 66666 6666GG",
|
||||
"GGGGGGGGGGGGGGGG"
|
||||
};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
caps
|
||||
chrmlite
|
||||
docshell
|
||||
editor
|
||||
embedcomponents
|
||||
gfx_gtk
|
||||
gklayout
|
||||
gkplugin
|
||||
htmlpars
|
||||
i18n
|
||||
imglib2
|
||||
jar50
|
||||
jsdom
|
||||
necko
|
||||
nsappshell
|
||||
pipboot
|
||||
pipnss
|
||||
pref
|
||||
uconv
|
||||
webbrwsr
|
||||
widget_gtk2
|
||||
xpconnect
|
Загрузка…
Ссылка в новой задаче