View | Details | Raw Unified | Return to bug 230478
Collapse All | Expand All

(-)a/ChangeLog (+18 lines)
Lines 1-5 Link Here
1
2007-12-19  Federico Mena Quintero  <federico@novell.com>
1
2007-12-19  Federico Mena Quintero  <federico@novell.com>
2
2
3
	* main-menu/src/main-menu-ui.c (select_page): Take in a
4
	"set_page_selector_button" argument, to decide whether we set the
5
	correct button here as well.  Also, set the notebook page.  This
6
	makes this function be the central place to switch pages based on
7
	the GConf key.
8
	(page_button_toggled_cb): Set the GConf key, *then* call
9
	select_page.  Don't change any widgets here.
10
	(current_page_notify_cb): Removed.  Not monitoring the GConf key
11
	will allow us to implement "last one wins" once the main-menu
12
	supports being used from multiple screens simultaneously.
13
	(create_file_section): Don't add a GConf notifier for
14
	CURRENT_PAGE_GCONF_KEY.
15
	(MainMenuUIPrivate): New field "page_selectors_toggled_ids".
16
	(create_file_section): Save the signal handler ID for "toggled"
17
	from each page selector.
18
19
2007-12-19  Federico Mena Quintero  <federico@novell.com>
20
3
	* main-menu/src/main-menu-ui.c (page_button_toggled_cb): Renamed
21
	* main-menu/src/main-menu-ui.c (page_button_toggled_cb): Renamed
4
	from page_button_clicked_cb.  See if the button is actually
22
	from page_button_clicked_cb.  See if the button is actually
5
	active, to avoid switching pages twice every time one of the page
23
	active, to avoid switching pages twice every time one of the page
(-)a/main-menu/src/main-menu-ui.c (-31 / +23 lines)
Lines 98-103 typedef struct { Link Here
98
98
99
	GtkNotebook *file_section;
99
	GtkNotebook *file_section;
100
	GtkWidget   *page_selectors    [3];
100
	GtkWidget   *page_selectors    [3];
101
	gulong       page_selectors_toggled_ids[3];
101
	gint         notebook_page_ids [3];
102
	gint         notebook_page_ids [3];
102
103
103
	TileTable     *file_tables     [5];
104
	TileTable     *file_tables     [5];
Lines 120-126 typedef struct { Link Here
120
	GList                 *mounts;
121
	GList                 *mounts;
121
122
122
	guint search_cmd_gconf_mntr_id;
123
	guint search_cmd_gconf_mntr_id;
123
	guint current_page_gconf_mntr_id;
124
	guint more_link_vis_gconf_mntr_id;
124
	guint more_link_vis_gconf_mntr_id;
125
	guint search_vis_gconf_mntr_id;
125
	guint search_vis_gconf_mntr_id;
126
	guint status_vis_gconf_mntr_id;
126
	guint status_vis_gconf_mntr_id;
Lines 158-164 static void setup_file_tables (MainMenuUI *); Link Here
158
static void setup_bookmark_agents    (MainMenuUI *);
158
static void setup_bookmark_agents    (MainMenuUI *);
159
static void setup_lock_down          (MainMenuUI *);
159
static void setup_lock_down          (MainMenuUI *);
160
160
161
static void       select_page                (MainMenuUI *);
161
static void       select_page                (MainMenuUI *this, gboolean set_page_selector_button);
162
static void       update_limits              (MainMenuUI *);
162
static void       update_limits              (MainMenuUI *);
163
static void       connect_to_tile_triggers   (MainMenuUI *, TileTable *);
163
static void       connect_to_tile_triggers   (MainMenuUI *, TileTable *);
164
static void       hide_slab_if_urgent_close  (MainMenuUI *);
164
static void       hide_slab_if_urgent_close  (MainMenuUI *);
Lines 199-205 static void gtk_table_notify_cb (GObject *, GParamSpec *, gpoi Link Here
199
static void     tile_action_triggered_cb          (Tile *, TileEvent *, TileAction *, gpointer);
199
static void     tile_action_triggered_cb          (Tile *, TileEvent *, TileAction *, gpointer);
200
static void     more_buttons_clicked_cb            (GtkButton *, gpointer);
200
static void     more_buttons_clicked_cb            (GtkButton *, gpointer);
201
static void     search_cmd_notify_cb              (GConfClient *, guint, GConfEntry *, gpointer);
201
static void     search_cmd_notify_cb              (GConfClient *, guint, GConfEntry *, gpointer);
202
static void     current_page_notify_cb            (GConfClient *, guint, GConfEntry *, gpointer);
203
static void     lockdown_notify_cb                (GConfClient *, guint, GConfEntry *, gpointer);
202
static void     lockdown_notify_cb                (GConfClient *, guint, GConfEntry *, gpointer);
204
static void     panel_menu_open_cb                (BonoboUIComponent *, gpointer, const gchar *);
203
static void     panel_menu_open_cb                (BonoboUIComponent *, gpointer, const gchar *);
205
static void     panel_menu_about_cb               (BonoboUIComponent *, gpointer, const gchar *);
204
static void     panel_menu_about_cb               (BonoboUIComponent *, gpointer, const gchar *);
Lines 295-301 main_menu_ui_new (PanelApplet *applet) Link Here
295
294
296
	bind_beagle_search_key  (this);
295
	bind_beagle_search_key  (this);
297
	update_limits           (this);
296
	update_limits           (this);
298
	select_page             (this);
297
	select_page             (this, TRUE);
299
	apply_lockdown_settings (this);
298
	apply_lockdown_settings (this);
300
299
301
	return this;
300
	return this;
Lines 377-383 main_menu_ui_init (MainMenuUI *this) Link Here
377
	priv->volume_mon                                 = NULL;
376
	priv->volume_mon                                 = NULL;
378
377
379
	priv->search_cmd_gconf_mntr_id                   = 0;
378
	priv->search_cmd_gconf_mntr_id                   = 0;
380
	priv->current_page_gconf_mntr_id                 = 0;
381
	priv->more_link_vis_gconf_mntr_id                = 0;
379
	priv->more_link_vis_gconf_mntr_id                = 0;
382
	priv->search_vis_gconf_mntr_id                   = 0;
380
	priv->search_vis_gconf_mntr_id                   = 0;
383
	priv->status_vis_gconf_mntr_id                   = 0;
381
	priv->status_vis_gconf_mntr_id                   = 0;
Lines 416-422 main_menu_ui_finalize (GObject *g_obj) Link Here
416
	}
414
	}
417
415
418
	libslab_gconf_notify_remove (priv->search_cmd_gconf_mntr_id);
416
	libslab_gconf_notify_remove (priv->search_cmd_gconf_mntr_id);
419
	libslab_gconf_notify_remove (priv->current_page_gconf_mntr_id);
420
	libslab_gconf_notify_remove (priv->more_link_vis_gconf_mntr_id);
417
	libslab_gconf_notify_remove (priv->more_link_vis_gconf_mntr_id);
421
	libslab_gconf_notify_remove (priv->search_vis_gconf_mntr_id);
418
	libslab_gconf_notify_remove (priv->search_vis_gconf_mntr_id);
422
	libslab_gconf_notify_remove (priv->status_vis_gconf_mntr_id);
419
	libslab_gconf_notify_remove (priv->status_vis_gconf_mntr_id);
Lines 622-635 create_file_section (MainMenuUI *this) Link Here
622
		g_object_set_data (
619
		g_object_set_data (
623
			G_OBJECT (priv->page_selectors [i]), "page-type", GINT_TO_POINTER (i));
620
			G_OBJECT (priv->page_selectors [i]), "page-type", GINT_TO_POINTER (i));
624
621
625
		g_signal_connect (
622
		priv->page_selectors_toggled_ids[i] = g_signal_connect (
626
			G_OBJECT (priv->page_selectors [i]), "toggled",
623
			G_OBJECT (priv->page_selectors [i]), "toggled",
627
			G_CALLBACK (page_button_toggled_cb), this);
624
			G_CALLBACK (page_button_toggled_cb), this);
628
	}
625
	}
629
626
630
	priv->current_page_gconf_mntr_id = libslab_gconf_notify_add (
631
		CURRENT_PAGE_GCONF_KEY, current_page_notify_cb, this);
632
633
	priv->table_sections [USER_APPS_TABLE] = glade_xml_get_widget (
627
	priv->table_sections [USER_APPS_TABLE] = glade_xml_get_widget (
634
		priv->main_menu_xml, "user-apps-section");
628
		priv->main_menu_xml, "user-apps-section");
635
	priv->table_sections [RCNT_APPS_TABLE] = glade_xml_get_widget (
629
	priv->table_sections [RCNT_APPS_TABLE] = glade_xml_get_widget (
Lines 1041-1047 doc_uri_to_item (const gchar *uri, gpointer data) Link Here
1041
	info = gnome_vfs_file_info_new ();
1035
	info = gnome_vfs_file_info_new ();
1042
1036
1043
	gnome_vfs_get_file_info (
1037
	gnome_vfs_get_file_info (
1044
		item->uri, info, 
1038
		item->uri, info,
1045
		GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE);
1039
		GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE);
1046
1040
1047
	item->mime_type = g_strdup (info->mime_type);
1041
	item->mime_type = g_strdup (info->mime_type);
Lines 1115-1132 app_is_in_blacklist (const gchar *uri) Link Here
1115
}
1109
}
1116
1110
1117
static void
1111
static void
1118
select_page (MainMenuUI *this)
1112
select_page (MainMenuUI *this, gboolean set_page_selector_button)
1119
{
1113
{
1120
	MainMenuUIPrivate *priv = PRIVATE (this);
1114
	MainMenuUIPrivate *priv = PRIVATE (this);
1121
1122
	GtkToggleButton *button;
1123
	gint curr_page;
1115
	gint curr_page;
1124
1116
1125
1126
	curr_page = GPOINTER_TO_INT (libslab_get_gconf_value (CURRENT_PAGE_GCONF_KEY));
1117
	curr_page = GPOINTER_TO_INT (libslab_get_gconf_value (CURRENT_PAGE_GCONF_KEY));
1127
	button    = GTK_TOGGLE_BUTTON (priv->page_selectors [curr_page]);
1128
1118
1129
	gtk_toggle_button_set_active (button, TRUE);
1119
	if (set_page_selector_button) {
1120
		GtkToggleButton *button;
1121
1122
		g_signal_handler_block (priv->page_selectors[curr_page], priv->page_selectors_toggled_ids[curr_page]);
1123
1124
		button = GTK_TOGGLE_BUTTON (priv->page_selectors [curr_page]);
1125
		gtk_toggle_button_set_active (button, TRUE);
1126
1127
		g_signal_handler_unblock (priv->page_selectors[curr_page], priv->page_selectors_toggled_ids[curr_page]);
1128
	}
1129
1130
	gtk_notebook_set_current_page (priv->file_section, priv->notebook_page_ids [curr_page]);
1130
}
1131
}
1131
1132
1132
static void
1133
static void
Lines 1703-1709 slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_d Link Here
1703
/* draw window background */
1704
/* draw window background */
1704
1705
1705
	cairo_rectangle (
1706
	cairo_rectangle (
1706
		cr, 
1707
		cr,
1707
		widget->allocation.x + 0.5, widget->allocation.y + 0.5,
1708
		widget->allocation.x + 0.5, widget->allocation.y + 0.5,
1708
		widget->allocation.width - 1, widget->allocation.height - 1);
1709
		widget->allocation.width - 1, widget->allocation.height - 1);
1709
1710
Lines 1837-1844 slab_window_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer Link Here
1837
	MainMenuUIPrivate *priv = PRIVATE      (this);
1838
	MainMenuUIPrivate *priv = PRIVATE      (this);
1838
1839
1839
	GdkWindow *ptr_window;
1840
	GdkWindow *ptr_window;
1840
	
1841
1841
	
1842
1842
	ptr_window = gdk_window_at_pointer (NULL, NULL);
1843
	ptr_window = gdk_window_at_pointer (NULL, NULL);
1843
1844
1844
	if (priv->slab_window->window != ptr_window) {
1845
	if (priv->slab_window->window != ptr_window) {
Lines 1976-1982 search_entry_activate_cb (GtkEntry *entry, gpointer user_data) Link Here
1976
static void
1977
static void
1977
page_button_toggled_cb (GtkToggleButton *button, gpointer user_data)
1978
page_button_toggled_cb (GtkToggleButton *button, gpointer user_data)
1978
{
1979
{
1979
	MainMenuUIPrivate *priv = PRIVATE (user_data);
1980
	MainMenuUI *this = MAIN_MENU_UI (user_data);
1980
	gint page_type;
1981
	gint page_type;
1981
1982
1982
	if (!gtk_toggle_button_get_active (button))
1983
	if (!gtk_toggle_button_get_active (button))
Lines 1984-1992 page_button_toggled_cb (GtkToggleButton *button, gpointer user_data) Link Here
1984
1985
1985
	page_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "page-type"));
1986
	page_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "page-type"));
1986
1987
1987
	gtk_notebook_set_current_page (priv->file_section, priv->notebook_page_ids [page_type]);
1988
1989
	libslab_set_gconf_value (CURRENT_PAGE_GCONF_KEY, GINT_TO_POINTER (page_type));
1988
	libslab_set_gconf_value (CURRENT_PAGE_GCONF_KEY, GINT_TO_POINTER (page_type));
1989
	select_page (this, FALSE);
1990
}
1990
}
1991
1991
1992
static void
1992
static void
Lines 2110-2122 search_cmd_notify_cb (GConfClient *client, guint conn_id, Link Here
2110
}
2110
}
2111
2111
2112
static void
2112
static void
2113
current_page_notify_cb (GConfClient *client, guint conn_id,
2114
                        GConfEntry *entry, gpointer user_data)
2115
{
2116
	select_page (MAIN_MENU_UI (user_data));
2117
}
2118
2119
static void
2120
lockdown_notify_cb (GConfClient *client, guint conn_id,
2113
lockdown_notify_cb (GConfClient *client, guint conn_id,
2121
                    GConfEntry *entry, gpointer user_data)
2114
                    GConfEntry *entry, gpointer user_data)
2122
{
2115
{
2123
- 

Return to bug 230478