Bugzilla – Attachment 203583 Details for
Bug 230478
main-menu: pointless thumbnailing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
Centralize page switching
0002-Clean-up-the-way-pages-are-switched.patch (text/plain), 9.04 KB, created by
Federico Mena Quintero
on 2008-03-24 17:26:40 UTC
(
hide
)
Description:
Centralize page switching
Filename:
MIME Type:
Creator:
Federico Mena Quintero
Created:
2008-03-24 17:26:40 UTC
Size:
9.04 KB
patch
obsolete
>From 19e97e64b7280619a1522c87aa04aa57ed557d0e Mon Sep 17 00:00:00 2001 >From: Federico Mena Quintero <federico@gnu.org> >Date: Wed, 19 Dec 2007 15:57:12 -0600 >Subject: [PATCH] Clean up the way pages are switched > 2007-12-19 Federico Mena Quintero <federico@novell.com> > > * main-menu/src/main-menu-ui.c (select_page): Take in a > "set_page_selector_button" argument, to decide whether we set the > correct button here as well. Also, set the notebook page. This > makes this function be the central place to switch pages based on > the GConf key. > (page_button_toggled_cb): Set the GConf key, *then* call > select_page. Don't change any widgets here. > (current_page_notify_cb): Removed. Not monitoring the GConf key > will allow us to implement "last one wins" once the main-menu > supports being used from multiple screens simultaneously. > (create_file_section): Don't add a GConf notifier for > CURRENT_PAGE_GCONF_KEY. > (MainMenuUIPrivate): New field "page_selectors_toggled_ids". > (create_file_section): Save the signal handler ID for "toggled" > from each page selector. > >Signed-off-by: Federico Mena Quintero <federico@gnu.org> >--- > ChangeLog | 18 ++++++++++++++ > main-menu/src/main-menu-ui.c | 53 ++++++++++++++++++----------------------- > 2 files changed, 41 insertions(+), 30 deletions(-) > >diff --git a/ChangeLog b/ChangeLog >index 1d462b1..7d41188 100644 >--- a/ChangeLog >+++ b/ChangeLog >@@ -1,5 +1,23 @@ > 2007-12-19 Federico Mena Quintero <federico@novell.com> > >+ * main-menu/src/main-menu-ui.c (select_page): Take in a >+ "set_page_selector_button" argument, to decide whether we set the >+ correct button here as well. Also, set the notebook page. This >+ makes this function be the central place to switch pages based on >+ the GConf key. >+ (page_button_toggled_cb): Set the GConf key, *then* call >+ select_page. Don't change any widgets here. >+ (current_page_notify_cb): Removed. Not monitoring the GConf key >+ will allow us to implement "last one wins" once the main-menu >+ supports being used from multiple screens simultaneously. >+ (create_file_section): Don't add a GConf notifier for >+ CURRENT_PAGE_GCONF_KEY. >+ (MainMenuUIPrivate): New field "page_selectors_toggled_ids". >+ (create_file_section): Save the signal handler ID for "toggled" >+ from each page selector. >+ >+2007-12-19 Federico Mena Quintero <federico@novell.com> >+ > * main-menu/src/main-menu-ui.c (page_button_toggled_cb): Renamed > from page_button_clicked_cb. See if the button is actually > active, to avoid switching pages twice every time one of the page >diff --git a/main-menu/src/main-menu-ui.c b/main-menu/src/main-menu-ui.c >index a81df6c..487400f 100644 >--- a/main-menu/src/main-menu-ui.c >+++ b/main-menu/src/main-menu-ui.c >@@ -98,6 +98,7 @@ typedef struct { > > GtkNotebook *file_section; > GtkWidget *page_selectors [3]; >+ gulong page_selectors_toggled_ids[3]; > gint notebook_page_ids [3]; > > TileTable *file_tables [5]; >@@ -120,7 +121,6 @@ typedef struct { > GList *mounts; > > guint search_cmd_gconf_mntr_id; >- guint current_page_gconf_mntr_id; > guint more_link_vis_gconf_mntr_id; > guint search_vis_gconf_mntr_id; > guint status_vis_gconf_mntr_id; >@@ -158,7 +158,7 @@ static void setup_file_tables (MainMenuUI *); > static void setup_bookmark_agents (MainMenuUI *); > static void setup_lock_down (MainMenuUI *); > >-static void select_page (MainMenuUI *); >+static void select_page (MainMenuUI *this, gboolean set_page_selector_button); > static void update_limits (MainMenuUI *); > static void connect_to_tile_triggers (MainMenuUI *, TileTable *); > static void hide_slab_if_urgent_close (MainMenuUI *); >@@ -199,7 +199,6 @@ static void gtk_table_notify_cb (GObject *, GParamSpec *, gpoi > static void tile_action_triggered_cb (Tile *, TileEvent *, TileAction *, gpointer); > static void more_buttons_clicked_cb (GtkButton *, gpointer); > static void search_cmd_notify_cb (GConfClient *, guint, GConfEntry *, gpointer); >-static void current_page_notify_cb (GConfClient *, guint, GConfEntry *, gpointer); > static void lockdown_notify_cb (GConfClient *, guint, GConfEntry *, gpointer); > static void panel_menu_open_cb (BonoboUIComponent *, gpointer, const gchar *); > static void panel_menu_about_cb (BonoboUIComponent *, gpointer, const gchar *); >@@ -295,7 +294,7 @@ main_menu_ui_new (PanelApplet *applet) > > bind_beagle_search_key (this); > update_limits (this); >- select_page (this); >+ select_page (this, TRUE); > apply_lockdown_settings (this); > > return this; >@@ -377,7 +376,6 @@ main_menu_ui_init (MainMenuUI *this) > priv->volume_mon = NULL; > > priv->search_cmd_gconf_mntr_id = 0; >- priv->current_page_gconf_mntr_id = 0; > priv->more_link_vis_gconf_mntr_id = 0; > priv->search_vis_gconf_mntr_id = 0; > priv->status_vis_gconf_mntr_id = 0; >@@ -416,7 +414,6 @@ main_menu_ui_finalize (GObject *g_obj) > } > > libslab_gconf_notify_remove (priv->search_cmd_gconf_mntr_id); >- libslab_gconf_notify_remove (priv->current_page_gconf_mntr_id); > libslab_gconf_notify_remove (priv->more_link_vis_gconf_mntr_id); > libslab_gconf_notify_remove (priv->search_vis_gconf_mntr_id); > libslab_gconf_notify_remove (priv->status_vis_gconf_mntr_id); >@@ -622,14 +619,11 @@ create_file_section (MainMenuUI *this) > g_object_set_data ( > G_OBJECT (priv->page_selectors [i]), "page-type", GINT_TO_POINTER (i)); > >- g_signal_connect ( >+ priv->page_selectors_toggled_ids[i] = g_signal_connect ( > G_OBJECT (priv->page_selectors [i]), "toggled", > G_CALLBACK (page_button_toggled_cb), this); > } > >- priv->current_page_gconf_mntr_id = libslab_gconf_notify_add ( >- CURRENT_PAGE_GCONF_KEY, current_page_notify_cb, this); >- > priv->table_sections [USER_APPS_TABLE] = glade_xml_get_widget ( > priv->main_menu_xml, "user-apps-section"); > priv->table_sections [RCNT_APPS_TABLE] = glade_xml_get_widget ( >@@ -1041,7 +1035,7 @@ doc_uri_to_item (const gchar *uri, gpointer data) > info = gnome_vfs_file_info_new (); > > gnome_vfs_get_file_info ( >- item->uri, info, >+ item->uri, info, > GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE); > > item->mime_type = g_strdup (info->mime_type); >@@ -1115,18 +1109,25 @@ app_is_in_blacklist (const gchar *uri) > } > > static void >-select_page (MainMenuUI *this) >+select_page (MainMenuUI *this, gboolean set_page_selector_button) > { > MainMenuUIPrivate *priv = PRIVATE (this); >- >- GtkToggleButton *button; > gint curr_page; > >- > curr_page = GPOINTER_TO_INT (libslab_get_gconf_value (CURRENT_PAGE_GCONF_KEY)); >- button = GTK_TOGGLE_BUTTON (priv->page_selectors [curr_page]); > >- gtk_toggle_button_set_active (button, TRUE); >+ if (set_page_selector_button) { >+ GtkToggleButton *button; >+ >+ g_signal_handler_block (priv->page_selectors[curr_page], priv->page_selectors_toggled_ids[curr_page]); >+ >+ button = GTK_TOGGLE_BUTTON (priv->page_selectors [curr_page]); >+ gtk_toggle_button_set_active (button, TRUE); >+ >+ g_signal_handler_unblock (priv->page_selectors[curr_page], priv->page_selectors_toggled_ids[curr_page]); >+ } >+ >+ gtk_notebook_set_current_page (priv->file_section, priv->notebook_page_ids [curr_page]); > } > > static void >@@ -1703,7 +1704,7 @@ slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_d > /* draw window background */ > > cairo_rectangle ( >- cr, >+ cr, > widget->allocation.x + 0.5, widget->allocation.y + 0.5, > widget->allocation.width - 1, widget->allocation.height - 1); > >@@ -1837,8 +1838,8 @@ slab_window_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer > MainMenuUIPrivate *priv = PRIVATE (this); > > GdkWindow *ptr_window; >- >- >+ >+ > ptr_window = gdk_window_at_pointer (NULL, NULL); > > if (priv->slab_window->window != ptr_window) { >@@ -1976,7 +1977,7 @@ search_entry_activate_cb (GtkEntry *entry, gpointer user_data) > static void > page_button_toggled_cb (GtkToggleButton *button, gpointer user_data) > { >- MainMenuUIPrivate *priv = PRIVATE (user_data); >+ MainMenuUI *this = MAIN_MENU_UI (user_data); > gint page_type; > > if (!gtk_toggle_button_get_active (button)) >@@ -1984,9 +1985,8 @@ page_button_toggled_cb (GtkToggleButton *button, gpointer user_data) > > page_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "page-type")); > >- gtk_notebook_set_current_page (priv->file_section, priv->notebook_page_ids [page_type]); >- > libslab_set_gconf_value (CURRENT_PAGE_GCONF_KEY, GINT_TO_POINTER (page_type)); >+ select_page (this, FALSE); > } > > static void >@@ -2110,13 +2110,6 @@ search_cmd_notify_cb (GConfClient *client, guint conn_id, > } > > static void >-current_page_notify_cb (GConfClient *client, guint conn_id, >- GConfEntry *entry, gpointer user_data) >-{ >- select_page (MAIN_MENU_UI (user_data)); >-} >- >-static void > lockdown_notify_cb (GConfClient *client, guint conn_id, > GConfEntry *entry, gpointer user_data) > { >-- >1.5.3.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 230478
:
203582
|
203583
|
203584
|
203585
|
203586
|
206381