diff options
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | lib/ephy-autocompletion.c | 5 | ||||
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 24 | ||||
-rw-r--r-- | src/ephy-favicon-action.c | 3 | ||||
-rw-r--r-- | src/ephy-favorites-menu.c | 4 | ||||
-rw-r--r-- | src/ephy-window.c | 26 | ||||
-rwxr-xr-x | src/ppview-toolbar.c | 68 | ||||
-rwxr-xr-x | src/toolbar.c | 10 |
9 files changed, 125 insertions, 38 deletions
@@ -1,3 +1,25 @@ +2003-01-23 Marco Pesenti Gritti <marco@it.gnome.org> + + * TODO: + * lib/ephy-autocompletion.c: (ephy_autocompletion_reset), + (ephy_autocompletion_set_key), + (ephy_autocompletion_update_matches_full): + * lib/widgets/ephy-location-entry.c: + (get_editable_number_of_chars), (position_is_at_end), + (ephy_location_entry_key_press_event_cb): + * src/ephy-favicon-action.c: (ephy_favicon_action_finalize): + * src/ephy-favorites-menu.c: (ephy_favorites_menu_finalize_impl), + (ephy_favorites_menu_rebuild): + * src/ephy-window.c: (add_widget), (setup_window), + (ephy_window_finalize), (ephy_window_set_chrome): + * src/ppview-toolbar.c: (toolbar_update_sensitivity), + (ppview_toolbar_set_window), (toolbar_cmd_ppv_close): + * src/toolbar.c: (toolbar_setup_widgets), (toolbar_finalize): + + Fix autocompletion to not show duped entries. + Complete print preview impl. + Fix actions referencing, a bug in egg still blocking it though. + 2003-01-21 Marco Pesenti Gritti <marco@it.gnome.org> * embed/ephy-history.c: (ephy_history_host_set_title): @@ -6,6 +6,7 @@ To do: - save bookmarks dialog state (current keyword) - show bookmarks updated content - temporary bookmarks, maybe an expire checkbox in new bookmark dialog ? +- history shows empty hosts sometimes !? Done: diff --git a/lib/ephy-autocompletion.c b/lib/ephy-autocompletion.c index 361b0ed2f..3fd67a5df 100644 --- a/lib/ephy-autocompletion.c +++ b/lib/ephy-autocompletion.c @@ -174,7 +174,6 @@ ephy_autocompletion_reset (EphyAutocompletion *ac) START_PROFILER ("Resetting autocompletion") - acma_destroy (&p->matches); g_free (p->common_prefix); p->common_prefix = NULL; p->status = GAS_NEEDS_FULL_UPDATE; @@ -219,6 +218,8 @@ ephy_autocompletion_set_key (EphyAutocompletion *ac, } } + LOG ("Set key %s, old key %s", key, p->keys[0]) + if (keylen >= p->key_lengths[0] && !strncmp (p->keys[0], key, p->key_lengths[0])) { @@ -444,6 +445,8 @@ ephy_autocompletion_update_matches_full (EphyAutocompletion *ac) START_PROFILER ("Update full") + acma_destroy (&p->matches); + for (li = p->sources; li; li = li->next) { EphyAutocompletionSource *s = EPHY_AUTOCOMPLETION_SOURCE (li->data); diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 5a947a7b2..545c3bcaa 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -338,6 +338,27 @@ ephy_location_entry_autocompletion_to (EphyLocationEntry *w) return FALSE; } +static int +get_editable_number_of_chars (GtkEditable *editable) +{ + char *text; + int length; + + text = gtk_editable_get_chars (editable, 0, -1); + length = g_utf8_strlen (text, -1); + g_free (text); + return length; +} + +static gboolean +position_is_at_end (GtkEditable *editable) +{ + int end; + + end = get_editable_number_of_chars (editable); + return gtk_editable_get_position (editable) == end; +} + /* this is from the old location entry, need to do the autocompletion before implementing this */ static gboolean ephy_location_entry_key_press_event_cb (GtkWidget *entry, GdkEventKey *event, EphyLocationEntry *w) @@ -466,7 +487,8 @@ ephy_location_entry_key_press_event_cb (GtkWidget *entry, GdkEventKey *event, Ep break; default: ephy_location_entry_autocompletion_unselect_alternatives (w); - if ((event->string[0] > 32) && (event->string[0] < 126)) + if ((event->string[0] > 32) && (event->string[0] < 126) && + position_is_at_end (GTK_EDITABLE (entry))) { p->show_alternatives_timeout = g_timeout_add (SHOW_ALTERNATIVES_DELAY, diff --git a/src/ephy-favicon-action.c b/src/ephy-favicon-action.c index 84dcbca45..91605cf67 100644 --- a/src/ephy-favicon-action.c +++ b/src/ephy-favicon-action.c @@ -23,6 +23,7 @@ #include "ephy-dnd.h" #include "ephy-favicon-cache.h" #include "ephy-shell.h" +#include "ephy-debug.h" struct EphyFaviconActionPrivate { @@ -270,5 +271,7 @@ ephy_favicon_action_finalize (GObject *object) g_free (action->priv); + LOG ("Favicon action finalized") + G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/src/ephy-favorites-menu.c b/src/ephy-favorites-menu.c index 8a557a7ad..4c13072c8 100644 --- a/src/ephy-favorites-menu.c +++ b/src/ephy-favorites-menu.c @@ -138,8 +138,6 @@ ephy_favorites_menu_finalize_impl (GObject *o) EphyFavoritesMenu *wrhm = EPHY_FAVORITES_MENU (o); EphyFavoritesMenuPrivate *p = wrhm->priv; - ephy_favorites_menu_clean (wrhm); - g_free (p); G_OBJECT_CLASS (g_object_class)->finalize (o); @@ -207,6 +205,8 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *wrhm) LOG ("Rebuilding recent history menu") + ephy_favorites_menu_clean (wrhm); + fav = ephy_bookmarks_get_favorites (p->bookmarks); children = ephy_node_get_children (fav); diff --git a/src/ephy-window.c b/src/ephy-window.c index bf88d72e9..1da8cc949 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -42,6 +42,7 @@ #include <string.h> #include <libgnome/gnome-i18n.h> #include <libgnomevfs/gnome-vfs-uri.h> +#include <libgnomeui/gnome-stock-icons.h> #include <gtk/gtk.h> #include <X11/X.h> #include <X11/Xlib.h> @@ -203,7 +204,7 @@ static EggActionGroupEntry ephy_menu_entries [] = { G_CALLBACK (window_cmd_tabs_detach), NULL }, /* Help menu */ - { "HelpAbout", N_("_About"), NULL, NULL, + { "HelpAbout", N_("_About"), GNOME_STOCK_ABOUT, NULL, N_("Display credits for the web browser creators"), G_CALLBACK (window_cmd_help_about), NULL }, }; @@ -262,6 +263,7 @@ static guint ephy_popups_n_entries = G_N_ELEMENTS (ephy_popups_entries); struct EphyWindowPrivate { GtkWidget *main_vbox; + GtkWidget *menu_dock; GtkWidget *menubar; Toolbar *toolbar; GList *toolbars; @@ -429,7 +431,7 @@ add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyWindow *window) (window->priv->toolbars, widget); } - gtk_box_pack_start (GTK_BOX (window->priv->main_vbox), + gtk_box_pack_start (GTK_BOX (window->priv->menu_dock), widget, FALSE, FALSE, 0); } @@ -445,6 +447,12 @@ setup_window (EphyWindow *window) gtk_container_add (GTK_CONTAINER (window), window->priv->main_vbox); + window->priv->menu_dock = gtk_vbox_new (FALSE, 0); + gtk_widget_show (window->priv->menu_dock); + gtk_box_pack_start (GTK_BOX (window->priv->main_vbox), + GTK_WIDGET (window->priv->menu_dock), + FALSE, TRUE, 0); + for (i = 0; i < ephy_menu_n_entries; i++) { ephy_menu_entries[i].user_data = window; @@ -471,7 +479,8 @@ setup_window (EphyWindow *window) window->ui_merge = G_OBJECT (merge); g_signal_connect (merge, "add_widget", G_CALLBACK (add_widget), window); - egg_menu_merge_add_ui_from_file (merge, ephy_file ("epiphany-ui.xml"), NULL); + egg_menu_merge_add_ui_from_file + (merge, ephy_file ("epiphany-ui.xml"), NULL); gtk_window_add_accel_group (GTK_WINDOW (window), merge->accel_group); window->priv->toolbar = toolbar_new (window); @@ -631,6 +640,11 @@ ephy_window_finalize (GObject *object) g_object_unref (window->priv->fav_menu); + if (window->priv->toolbar) + { + g_object_unref (window->priv->toolbar); + } + if (window->priv->ppview_toolbar) { g_object_unref (window->priv->ppview_toolbar); @@ -641,6 +655,11 @@ ephy_window_finalize (GObject *object) g_list_free (window->priv->toolbars); } + g_object_unref (window->priv->action_group); + egg_menu_merge_remove_action_group (EGG_MENU_MERGE (window->ui_merge), + window->priv->action_group); + g_object_unref (window->ui_merge); + g_free (window->priv); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -823,6 +842,7 @@ ephy_window_set_chrome (EphyWindow *window, if (window->priv->ppview_toolbar) { g_object_unref (window->priv->ppview_toolbar); + window->priv->ppview_toolbar = NULL; } } diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c index fea06c2d7..78b3b33d9 100755 --- a/src/ppview-toolbar.c +++ b/src/ppview-toolbar.c @@ -33,11 +33,6 @@ #include <gtk/gtkentry.h> #include <gtk/gtkmenu.h> -#define PPV_GOTO_FIRST_PATH "/commands/PPVGotoFirst" -#define PPV_GOTO_LAST_PATH "/commands/PPVGotoLast" -#define PPV_GO_BACK_PATH "/commands/PPVGoBack" -#define PPV_GO_FORWARD_PATH "/commands/PPVGoForward" - static void ppview_toolbar_class_init (PPViewToolbarClass *klass); static void ppview_toolbar_init (PPViewToolbar *t); static void ppview_toolbar_finalize (GObject *object); @@ -64,6 +59,7 @@ static GObjectClass *parent_class = NULL; struct PPViewToolbarPrivate { EphyWindow *window; + EmbedChromeMask original_mask; EggMenuMerge *ui_merge; EggActionGroup *action_group; guint ui_id; @@ -208,6 +204,31 @@ ppview_toolbar_get_property (GObject *object, } static void +toolbar_update_sensitivity (PPViewToolbar *t) +{ + int pages, c_page; + EphyWindow *window = t->priv->window; + EphyEmbed *embed; + EggAction *action; + EggActionGroup *action_group = t->priv->action_group; + + embed = ephy_window_get_active_embed (window); + g_return_if_fail (embed != NULL); + + ephy_embed_print_preview_num_pages (embed, &pages); + c_page = t->priv->current_page; + + action = egg_action_group_get_action (action_group, "PPVGoBack"); + g_object_set (action, "sensitive", c_page > 1, NULL); + action = egg_action_group_get_action (action_group, "PPVGotoFirst"); + g_object_set (action, "sensitive", c_page > 1, NULL); + action = egg_action_group_get_action (action_group, "PPVGoForward"); + g_object_set (action, "sensitive", c_page < pages, NULL); + action = egg_action_group_get_action (action_group, "PPVGotoLast"); + g_object_set (action, "sensitive", c_page < pages, NULL); +} + +static void ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window) { g_return_if_fail (t->priv->window == NULL); @@ -215,12 +236,16 @@ ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window) t->priv->window = window; t->priv->ui_merge = EGG_MENU_MERGE (t->priv->window->ui_merge); + t->priv->original_mask = ephy_window_get_chrome (window); + t->priv->action_group = egg_action_group_new ("PPViewActions"); egg_action_group_add_actions (t->priv->action_group, entries, n_entries); egg_menu_merge_insert_action_group (t->priv->ui_merge, t->priv->action_group, 0); t->priv->ui_id = egg_menu_merge_add_ui_from_string (t->priv->ui_merge, ui_info, -1, NULL); + + toolbar_update_sensitivity (t); } static void @@ -273,30 +298,6 @@ ppview_toolbar_new (EphyWindow *window) } static void -toolbar_update_sensitivity (PPViewToolbar *t) -{ - int pages, c_page; - EphyWindow *window = t->priv->window; - EphyEmbed *embed; - - embed = ephy_window_get_active_embed (window); - g_return_if_fail (embed != NULL); - - ephy_embed_print_preview_num_pages (embed, &pages); - c_page = t->priv->current_page; -/* - ephy_bonobo_set_sensitive (t->priv->ui_component, - PPV_GO_BACK_PATH, c_page > 1); - ephy_bonobo_set_sensitive (t->priv->ui_component, - PPV_GOTO_FIRST_PATH, c_page > 1); - ephy_bonobo_set_sensitive (t->priv->ui_component, - PPV_GO_FORWARD_PATH, c_page < pages); - ephy_bonobo_set_sensitive (t->priv->ui_component, - PPV_GOTO_LAST_PATH, c_page < pages); - */ -} - -static void toolbar_cmd_ppv_goto_first (EggMenuMerge *merge, PPViewToolbar *t) { @@ -375,5 +376,14 @@ static void toolbar_cmd_ppv_close (EggMenuMerge *merge, PPViewToolbar *t) { + EphyWindow *window = t->priv->window; + EphyEmbed *embed; + + embed = ephy_window_get_active_embed (window); + g_return_if_fail (embed != NULL); + + ephy_window_set_chrome (t->priv->window, t->priv->original_mask); + + ephy_embed_print_preview_close (embed); } diff --git a/src/toolbar.c b/src/toolbar.c index e81163f86..c97311fc8 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -29,6 +29,7 @@ #include "ephy-favicon-action.h" #include "ephy-navigation-action.h" #include "window-commands.h" +#include "ephy-debug.h" static void toolbar_class_init (ToolbarClass *klass); static void toolbar_init (Toolbar *t); @@ -150,8 +151,8 @@ toolbar_get_property (GObject *object, static void toolbar_setup_widgets (Toolbar *t) { - egg_menu_merge_add_ui_from_file (t->priv->ui_merge, - ephy_file ("epiphany-toolbar.xml"), NULL); + egg_menu_merge_add_ui_from_file + (t->priv->ui_merge, ephy_file ("epiphany-toolbar.xml"), NULL); egg_menu_merge_ensure_update (t->priv->ui_merge); } @@ -260,19 +261,24 @@ toolbar_finalize (GObject *object) { Toolbar *t; ToolbarPrivate *p; + EggMenuMerge *merge; g_return_if_fail (object != NULL); g_return_if_fail (IS_TOOLBAR (object)); t = TOOLBAR (object); p = t->priv; + merge = EGG_MENU_MERGE (t->priv->window->ui_merge); g_return_if_fail (p != NULL); g_object_unref (t->priv->action_group); + egg_menu_merge_remove_action_group (merge, t->priv->action_group); g_free (t->priv); + LOG ("Toolbar finalized") + G_OBJECT_CLASS (parent_class)->finalize (object); } |