aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-06-23 17:57:21 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-06-23 17:57:21 +0800
commit6742f4d2c168a13221adb054520efc7390fe88dc (patch)
tree2115bff277ead194716f1a654e6d6019d6f9d79a /src
parent01b26909a89f11ea190a312ad0100b5254c97651 (diff)
downloadgsoc2013-epiphany-6742f4d2c168a13221adb054520efc7390fe88dc.tar
gsoc2013-epiphany-6742f4d2c168a13221adb054520efc7390fe88dc.tar.gz
gsoc2013-epiphany-6742f4d2c168a13221adb054520efc7390fe88dc.tar.bz2
gsoc2013-epiphany-6742f4d2c168a13221adb054520efc7390fe88dc.tar.lz
gsoc2013-epiphany-6742f4d2c168a13221adb054520efc7390fe88dc.tar.xz
gsoc2013-epiphany-6742f4d2c168a13221adb054520efc7390fe88dc.tar.zst
gsoc2013-epiphany-6742f4d2c168a13221adb054520efc7390fe88dc.zip
Remove some unused headers.
2003-06-23 Marco Pesenti Gritti <marco@it.gnome.org> * embed/mozilla/GlobalHistory.cpp: Remove some unused headers. * embed/mozilla/mozilla-embed.cpp: Dont asser when trying to print blank page. * lib/Makefile.am: * lib/ephy-autocompletion.c: (ephy_autocompletion_get_type): * lib/widgets/ephy-autocompletion-window.c: (ephy_autocompletion_window_get_type): * lib/widgets/ephy-location-entry.c: (ephy_location_entry_get_type): * src/ephy-encoding-menu.c: (ephy_encoding_menu_get_type): Get rid of the gobject macros. * src/ephy-notebook.c: (move_tab), (move_tab_to_another_notebook), (button_release_cb), (update_tabs_visibility), (tabs_visibility_notifier), (ephy_notebook_init), (ephy_notebook_finalize), (ephy_notebook_set_show_tabs): * src/ephy-notebook.h: * src/ephy-tabs-menu.c: * src/ephy-window.c: (ephy_window_finalize), (update_embed_dialogs), (ephy_window_get_find_dialog), (print_dialog_preview_cb), (ephy_window_print): * src/ephy-window.h: * src/ppview-toolbar.c: (toolbar_cmd_ppv_close): * src/window-commands.c: (window_cmd_file_print): Make sure tabs are hidden when going in print preview mode. Make print dialog transient.
Diffstat (limited to 'src')
-rw-r--r--src/ephy-encoding-menu.c34
-rw-r--r--src/ephy-notebook.c251
-rw-r--r--src/ephy-notebook.h3
-rw-r--r--src/ephy-tabs-menu.c1
-rw-r--r--src/ephy-window.c51
-rw-r--r--src/ephy-window.h4
-rwxr-xr-xsrc/ppview-toolbar.c4
-rw-r--r--src/window-commands.c22
8 files changed, 216 insertions, 154 deletions
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index 58dd153a1..a664d5838 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -21,7 +21,6 @@
#endif
#include "ephy-encoding-menu.h"
-#include "ephy-gobject-misc.h"
#include "ephy-string.h"
#include "egg-menu-merge.h"
#include "ephy-shell.h"
@@ -64,14 +63,33 @@ enum
static gpointer g_object_class;
-/**
- * EphyEncodingMenu object
- */
-MAKE_GET_TYPE (ephy_encoding_menu,
- "EphyEncodingMenu", EphyEncodingMenu,
- ephy_encoding_menu_class_init, ephy_encoding_menu_init,
- G_TYPE_OBJECT);
+GType
+ephy_encoding_menu_get_type (void)
+{
+ static GType ephy_encoding_menu_type = 0;
+ if (ephy_encoding_menu_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyEncodingMenuClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) ephy_encoding_menu_class_init,
+ NULL,
+ NULL,
+ sizeof (EphyEncodingMenu),
+ 0,
+ (GInstanceInitFunc) ephy_encoding_menu_init
+ };
+
+ ephy_encoding_menu_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyEncodingMenu",
+ &our_info, 0);
+ }
+
+ return ephy_encoding_menu_type;
+}
static void
ephy_encoding_menu_class_init (EphyEncodingMenuClass *klass)
{
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 6671ee3b3..46dda88ea 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -45,21 +45,22 @@ struct EphyNotebookPrivate
{
GList *focused_pages;
GList *opened_tabs;
-
GtkTooltips *title_tips;
-
- /* Used during tab drag'n'drop */
+ guint tabs_vis_notifier_id;
gulong motion_notify_handler_id;
gint x_start, y_start;
gboolean drag_in_progress;
+ gboolean show_tabs;
EphyNotebook *src_notebook;
gint src_page;
};
-/* GObject boilerplate code */
-static void ephy_notebook_init (EphyNotebook *notebook);
-static void ephy_notebook_class_init (EphyNotebookClass *klass);
-static void ephy_notebook_finalize (GObject *object);
+static void ephy_notebook_init (EphyNotebook *notebook);
+static void ephy_notebook_class_init (EphyNotebookClass *klass);
+static void ephy_notebook_finalize (GObject *object);
+static void move_tab_to_another_notebook (EphyNotebook *src,
+ EphyNotebook *dest,
+ gint dest_page);
/* Local variables */
static GdkCursor *cursor = NULL;
@@ -72,17 +73,6 @@ static GtkTargetEntry url_drag_types [] =
};
static guint n_url_drag_types = G_N_ELEMENTS (url_drag_types);
-/* Local functions */
-static void drag_start (EphyNotebook *notebook,
- EphyNotebook *src_notebook,
- gint src_page);
-static void drag_stop (EphyNotebook *notebook);
-
-static gboolean motion_notify_cb (EphyNotebook *notebook,
- GdkEventMotion *event,
- gpointer data);
-
-/* Signals */
enum
{
TAB_ADDED,
@@ -361,64 +351,6 @@ ephy_notebook_move_page (EphyNotebook *src, EphyNotebook *dest,
}
static void
-move_tab_to_another_notebook(EphyNotebook *src,
- EphyNotebook *dest, gint dest_page)
-{
- GtkWidget *child;
- gint cur_page;
-
- /* This is getting tricky, the tab was dragged in a notebook
- * in another window of the same app, we move the tab
- * to that new notebook, and let this notebook handle the
- * drag
- */
- g_assert (dest != NULL);
- g_assert (dest != src);
-
- /* Move the widgets (tab label and tab content) to the new
- * notebook
- */
- cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (src));
- child = gtk_notebook_get_nth_page (GTK_NOTEBOOK (src), cur_page);
- ephy_notebook_move_page (src, dest, child, dest_page);
-
- /* "Give" drag handling to the new notebook */
- drag_start (dest, src->priv->src_notebook, src->priv->src_page);
- drag_stop (src);
- gtk_grab_remove (GTK_WIDGET (src));
-
- dest->priv->motion_notify_handler_id =
- g_signal_connect (G_OBJECT (dest),
- "motion-notify-event",
- G_CALLBACK (motion_notify_cb),
- NULL);
-}
-
-/* this function is only called during dnd, we don't need to emit TABS_REORDERED
- * here, instead we do it on drag_stop
- */
-static void
-move_tab (EphyNotebook *notebook, gint dest_page_num)
-{
- gint cur_page_num;
-
- cur_page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
-
- if (dest_page_num != cur_page_num)
- {
- GtkWidget *cur_page;
- cur_page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook),
- cur_page_num);
- ephy_notebook_move_page (EPHY_NOTEBOOK (notebook), NULL, cur_page,
- dest_page_num);
-
- /* Reset the list of newly opened tabs when moving tabs. */
- g_list_free (notebook->priv->opened_tabs);
- notebook->priv->opened_tabs = NULL;
- }
-}
-
-static void
drag_start (EphyNotebook *notebook,
EphyNotebook *src_notebook,
gint src_page)
@@ -459,41 +391,30 @@ drag_stop (EphyNotebook *notebook)
}
}
-/* Callbacks */
-static gboolean
-button_release_cb (EphyNotebook *notebook, GdkEventButton *event,
- gpointer data)
+/* this function is only called during dnd, we don't need to emit TABS_REORDERED
+ * here, instead we do it on drag_stop
+ */
+static void
+move_tab (EphyNotebook *notebook, gint dest_page_num)
{
- if (notebook->priv->drag_in_progress)
+ gint cur_page_num;
+
+ cur_page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
+
+ if (dest_page_num != cur_page_num)
{
- gint cur_page_num;
GtkWidget *cur_page;
-
- cur_page_num =
- gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
cur_page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook),
cur_page_num);
+ ephy_notebook_move_page (EPHY_NOTEBOOK (notebook), NULL, cur_page,
+ dest_page_num);
- if (!is_in_notebook_window (notebook, event->x_root, event->y_root))
- {
- /* Tab was detached */
- g_signal_emit (G_OBJECT (notebook),
- signals[TAB_DETACHED], 0, cur_page);
- }
-
- /* ungrab the pointer if it's grabbed */
- if (gdk_pointer_is_grabbed ())
- {
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gtk_grab_remove (GTK_WIDGET (notebook));
- }
+ /* Reset the list of newly opened tabs when moving tabs. */
+ g_list_free (notebook->priv->opened_tabs);
+ notebook->priv->opened_tabs = NULL;
}
- /* This must be called even if a drag isn't happening */
- drag_stop (notebook);
- return FALSE;
}
-
static gboolean
motion_notify_cb (EphyNotebook *notebook, GdkEventMotion *event,
gpointer data)
@@ -542,6 +463,75 @@ motion_notify_cb (EphyNotebook *notebook, GdkEventMotion *event,
return FALSE;
}
+static void
+move_tab_to_another_notebook(EphyNotebook *src,
+ EphyNotebook *dest, gint dest_page)
+{
+ GtkWidget *child;
+ gint cur_page;
+
+ /* This is getting tricky, the tab was dragged in a notebook
+ * in another window of the same app, we move the tab
+ * to that new notebook, and let this notebook handle the
+ * drag
+ */
+ g_assert (dest != NULL);
+ g_assert (dest != src);
+
+ /* Move the widgets (tab label and tab content) to the new
+ * notebook
+ */
+ cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (src));
+ child = gtk_notebook_get_nth_page (GTK_NOTEBOOK (src), cur_page);
+ ephy_notebook_move_page (src, dest, child, dest_page);
+
+ /* "Give" drag handling to the new notebook */
+ drag_start (dest, src->priv->src_notebook, src->priv->src_page);
+ drag_stop (src);
+ gtk_grab_remove (GTK_WIDGET (src));
+
+ dest->priv->motion_notify_handler_id =
+ g_signal_connect (G_OBJECT (dest),
+ "motion-notify-event",
+ G_CALLBACK (motion_notify_cb),
+ NULL);
+}
+
+/* Callbacks */
+static gboolean
+button_release_cb (EphyNotebook *notebook, GdkEventButton *event,
+ gpointer data)
+{
+ if (notebook->priv->drag_in_progress)
+ {
+ gint cur_page_num;
+ GtkWidget *cur_page;
+
+ cur_page_num =
+ gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
+ cur_page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook),
+ cur_page_num);
+
+ if (!is_in_notebook_window (notebook, event->x_root, event->y_root))
+ {
+ /* Tab was detached */
+ g_signal_emit (G_OBJECT (notebook),
+ signals[TAB_DETACHED], 0, cur_page);
+ }
+
+ /* ungrab the pointer if it's grabbed */
+ if (gdk_pointer_is_grabbed ())
+ {
+ gdk_pointer_ungrab (GDK_CURRENT_TIME);
+ gtk_grab_remove (GTK_WIDGET (notebook));
+ }
+ }
+ /* This must be called even if a drag isn't happening */
+ drag_stop (notebook);
+ return FALSE;
+}
+
+
static gboolean
button_press_cb (EphyNotebook *notebook,
GdkEventButton *event,
@@ -688,6 +678,35 @@ notebook_drag_data_received_cb (GtkWidget* widget, GdkDragContext *context,
gnome_vfs_uri_list_free (uris);
}
+/*
+ * update_tabs_visibility: Hide tabs if there is only one tab
+ * and the pref is not set.
+ */
+static void
+update_tabs_visibility (EphyNotebook *nb, gboolean before_inserting)
+{
+ gboolean show_tabs;
+ guint num;
+
+ num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));
+
+ if (before_inserting) num++;
+
+ show_tabs = (eel_gconf_get_boolean (CONF_TABS_TABBED) || num > 1) &&
+ nb->priv->show_tabs == TRUE;
+
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), show_tabs);
+}
+
+static void
+tabs_visibility_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyNotebook *nb)
+{
+ update_tabs_visibility (nb, FALSE);
+}
+
static void
ephy_notebook_init (EphyNotebook *notebook)
{
@@ -703,6 +722,7 @@ ephy_notebook_init (EphyNotebook *notebook)
notebook->priv->src_page = -1;
notebook->priv->focused_pages = NULL;
notebook->priv->opened_tabs = NULL;
+ notebook->priv->show_tabs = TRUE;
notebooks = g_list_append (notebooks, notebook);
@@ -724,6 +744,10 @@ ephy_notebook_init (EphyNotebook *notebook)
GTK_DEST_DEFAULT_DROP,
url_drag_types,n_url_drag_types,
GDK_ACTION_MOVE | GDK_ACTION_COPY);
+
+ notebook->priv->tabs_vis_notifier_id = eel_gconf_notification_add
+ (CONF_TABS_TABBED,
+ (GConfClientNotifyFunc)tabs_visibility_notifier, notebook);
}
static void
@@ -733,6 +757,8 @@ ephy_notebook_finalize (GObject *object)
notebooks = g_list_remove (notebooks, notebook);
+ eel_gconf_notification_remove (notebook->priv->tabs_vis_notifier_id);
+
if (notebook->priv->focused_pages)
{
g_list_free (notebook->priv->focused_pages);
@@ -742,7 +768,7 @@ ephy_notebook_finalize (GObject *object)
g_free (notebook->priv);
- LOG ("EphyNotebook finalised %p", object)
+ LOG ("EphyNotebook finalised %p", object)
}
static void
@@ -908,23 +934,12 @@ build_tab_label (EphyNotebook *nb, GtkWidget *child)
return hbox;
}
-/*
- * update_tabs_visibility: Hide tabs if there is only one tab
- * and the pref is not set.
- */
-static void
-update_tabs_visibility (EphyNotebook *nb, gboolean before_inserting)
+void
+ephy_notebook_set_show_tabs (EphyNotebook *nb, gboolean show_tabs)
{
- gboolean show_tabs;
- guint num;
+ nb->priv->show_tabs = show_tabs;
- num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));
-
- if (before_inserting) num++;
-
- show_tabs = eel_gconf_get_boolean (CONF_TABS_TABBED) || num > 1;
-
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), show_tabs);
+ update_tabs_visibility (nb, FALSE);
}
void
diff --git a/src/ephy-notebook.h b/src/ephy-notebook.h
index 454f8de10..ef5edd94b 100644
--- a/src/ephy-notebook.h
+++ b/src/ephy-notebook.h
@@ -85,6 +85,9 @@ void ephy_notebook_move_page (EphyNotebook *src,
GtkWidget *src_page,
gint dest_page);
+void ephy_notebook_set_show_tabs (EphyNotebook *nb,
+ gboolean show_tabs);
+
G_END_DECLS
#endif /* EPHY_NOTEBOOK_H */
diff --git a/src/ephy-tabs-menu.c b/src/ephy-tabs-menu.c
index 627cf7f73..afa87e5d0 100644
--- a/src/ephy-tabs-menu.c
+++ b/src/ephy-tabs-menu.c
@@ -21,7 +21,6 @@
#endif
#include "ephy-tabs-menu.h"
-#include "ephy-gobject-misc.h"
#include "ephy-string.h"
#include "egg-menu-merge.h"
#include "ephy-marshal.h"
diff --git a/src/ephy-window.c b/src/ephy-window.c
index b27cdaef3..f821b4e48 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -26,10 +26,10 @@
#include "ephy-bookmarks-menu.h"
#include "ephy-favorites-menu.h"
#include "ephy-state.h"
-#include "ephy-gobject-misc.h"
#include "ppview-toolbar.h"
#include "window-commands.h"
#include "find-dialog.h"
+#include "print-dialog.h"
#include "ephy-shell.h"
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
@@ -277,6 +277,7 @@ struct EphyWindowPrivate
GtkNotebook *notebook;
EphyTab *active_tab;
EphyDialog *find_dialog;
+ EphyDialog *print_dialog;
EmbedChromeMask chrome_mask;
gboolean closing;
gboolean is_fullscreen;
@@ -1476,12 +1477,14 @@ ephy_window_finalize (GObject *object)
if (window->priv->find_dialog)
{
- g_signal_handlers_disconnect_by_func (window->priv->find_dialog,
- G_CALLBACK (sync_find_dialog),
- window);
g_object_unref (G_OBJECT (window->priv->find_dialog));
}
+ if (window->priv->print_dialog)
+ {
+ g_object_unref (G_OBJECT (window->priv->print_dialog));
+ }
+
g_object_unref (window->priv->fav_menu);
g_object_unref (window->priv->enc_menu);
g_object_unref (window->priv->tabs_menu);
@@ -1802,6 +1805,7 @@ update_embed_dialogs (EphyWindow *window,
{
EphyEmbed *embed;
EphyDialog *find_dialog = window->priv->find_dialog;
+ EphyDialog *print_dialog = window->priv->print_dialog;
embed = ephy_tab_get_embed (tab);
@@ -1811,6 +1815,13 @@ update_embed_dialogs (EphyWindow *window,
(EPHY_EMBED_DIALOG(find_dialog),
embed);
}
+
+ if (print_dialog)
+ {
+ ephy_embed_dialog_set_embed
+ (EPHY_EMBED_DIALOG(print_dialog),
+ embed);
+ }
}
static void
@@ -1863,6 +1874,38 @@ ephy_window_get_find_dialog (EphyWindow *window)
return dialog;
}
+static void
+print_dialog_preview_cb (EphyDialog *dialog,
+ EphyWindow *window)
+{
+ ephy_window_set_chrome (window, EMBED_CHROME_PPVIEWTOOLBARON);
+ ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (window->priv->notebook), FALSE);
+}
+
+void
+ephy_window_print (EphyWindow *window)
+{
+ EphyDialog *dialog;
+ EphyEmbed *embed;
+
+ if (window->priv->print_dialog)
+ {
+ dialog = window->priv->print_dialog;
+ }
+ else
+ {
+ embed = ephy_window_get_active_embed (window);
+ dialog = print_dialog_new_with_parent (GTK_WIDGET(window),
+ embed, NULL);
+ g_signal_connect (G_OBJECT(dialog),
+ "preview",
+ G_CALLBACK (print_dialog_preview_cb),
+ window);
+ }
+
+ ephy_dialog_show (EPHY_DIALOG (dialog));
+}
+
void
ephy_window_set_zoom (EphyWindow *window,
float zoom)
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 67c6f4000..092c30020 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -102,8 +102,6 @@ void ephy_window_activate_location (EphyWindow *window);
void ephy_window_update_control (EphyWindow *window,
ControlID control);
-void ephy_window_update_all_controls (EphyWindow *window);
-
EphyTab *ephy_window_get_active_tab (EphyWindow *window);
EphyEmbed *ephy_window_get_active_embed (EphyWindow *window);
@@ -116,6 +114,8 @@ Toolbar *ephy_window_get_toolbar (EphyWindow *window);
EphyDialog *ephy_window_get_find_dialog (EphyWindow *window);
+void ephy_window_print (EphyWindow *window);
+
G_END_DECLS
#endif
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c
index a6e8b9a1f..48706a822 100755
--- a/src/ppview-toolbar.c
+++ b/src/ppview-toolbar.c
@@ -380,12 +380,16 @@ toolbar_cmd_ppv_close (EggMenuMerge *merge,
{
EphyWindow *window = t->priv->window;
EphyEmbed *embed;
+ EphyNotebook *notebook;
embed = ephy_window_get_active_embed (window);
g_return_if_fail (embed != NULL);
ephy_window_set_chrome (t->priv->window, t->priv->original_mask);
+ notebook = ephy_window_get_notebook (window);
+ ephy_notebook_set_show_tabs (notebook, TRUE);
+
ephy_embed_print_preview_close (embed);
}
diff --git a/src/window-commands.c b/src/window-commands.c
index 84294dfc8..74d7779f8 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -66,31 +66,11 @@ window_cmd_edit_find (EggAction *action,
ephy_dialog_show (dialog);
}
-static void
-print_dialog_preview_cb (PrintDialog *dialog,
- EphyWindow *window)
-{
- ephy_window_set_chrome (window, EMBED_CHROME_PPVIEWTOOLBARON);
-}
-
void
window_cmd_file_print (EggAction *action,
EphyWindow *window)
{
- EphyDialog *dialog;
- EphyEmbed *embed;
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- dialog = print_dialog_new_with_parent (GTK_WIDGET(window),
- embed, NULL);
- g_signal_connect (G_OBJECT(dialog),
- "preview",
- G_CALLBACK (print_dialog_preview_cb),
- window);
- ephy_dialog_set_modal (dialog, TRUE);
- ephy_dialog_show (dialog);
+ ephy_window_print (window);
}
void