static void
panel_drawer_connect_to_gconf (Drawer *drawer)
{
	GConfClient *client;
	const char  *key;
	int          i = 0;

	client  = panel_gconf_get_client ();
	
	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, drawer->info->id, "use_custom_icon");
        drawer->listeners [i++] =
		gconf_client_notify_add (client, key,
					 (GConfClientNotifyFunc) panel_drawer_use_custom_icon_changed,
					 drawer, NULL, NULL);

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, drawer->info->id, "custom_icon");
        drawer->listeners [i++] =
		gconf_client_notify_add (client, key,
					 (GConfClientNotifyFunc) panel_drawer_custom_icon_changed,
					 drawer, NULL, NULL);

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, drawer->info->id, "tooltip");
        drawer->listeners [i++] =
		gconf_client_notify_add (client, key,
					 (GConfClientNotifyFunc) panel_drawer_tooltip_changed,
					 drawer, NULL, NULL);

	g_assert (i == PANEL_DRAWER_N_LISTENERS);
}
static PanelToplevel *
create_drawer_toplevel (const char *drawer_id)
{
	PanelToplevel *toplevel;
	GConfClient   *client;
	const char    *key;
	char          *toplevel_id;

	client  = panel_gconf_get_client ();

	toplevel_id = panel_profile_find_new_id (PANEL_GCONF_TOPLEVELS);
	
	toplevel = panel_profile_load_toplevel (client, PANEL_CONFIG_DIR,
						PANEL_GCONF_TOPLEVELS, toplevel_id);

	if (!toplevel) {
		g_free (toplevel_id);
		return NULL;
	}

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, drawer_id, "attached_toplevel_id");
	gconf_client_set_string (client, key, toplevel_id, NULL);
	g_free (toplevel_id);

	panel_profile_set_toplevel_enable_buttons (toplevel, TRUE);
	panel_profile_set_toplevel_enable_arrows (toplevel, TRUE);

	return toplevel;
}
void
panel_session_request_logout (void)
{
	GnomeClient *client;
	static int   recursion_guard = 0;

	if (recursion_guard)
		return;

	recursion_guard++;

	if (!(client = gnome_master_client ()))
		return;

	/* Only request a Global save. We only want a Local
	 * save if the user selects 'Save current setup'
	 * from the dialog.
	 */
	gnome_client_request_save (client,
				   GNOME_SAVE_GLOBAL,
				   TRUE,
				   GNOME_INTERACT_ANY,
				   gconf_client_get_bool (panel_gconf_get_client (), "/apps/panel/global/upstream_session", NULL), /* use the gnome-session gui */
				   TRUE);

	recursion_guard--;
}
Example #4
0
static char *
panel_util_get_file_display_for_common_files (GFile *file)
{
	GFile *compare;

	compare = g_file_new_for_path (g_get_home_dir ());
	if (g_file_equal (file, compare)) {
		char *gconf_name;

		g_object_unref (compare);

		gconf_name = gconf_client_get_string (panel_gconf_get_client (),
						      HOME_NAME_KEY,
						      NULL);
		if (PANEL_GLIB_STR_EMPTY (gconf_name)) {
			g_free (gconf_name);
			return g_strdup (_("Home Folder"));
		} else {
			return gconf_name;
		}
	}
	g_object_unref (compare);

	compare = g_file_new_for_path ("/");
	if (g_file_equal (file, compare)) {
		g_object_unref (compare);
		/* Translators: this is the same string as the one found in
		 * nautilus */
		return g_strdup (_("File System"));
	}
	g_object_unref (compare);

	return NULL;
}
static void
panel_binding_watch (PanelBinding *binding,
		     const char   *key)
{
	GError *error = NULL;

	gconf_client_notify_add (panel_gconf_get_client (), key,
				(GConfClientNotifyFunc) panel_binding_changed,
				binding, NULL, &error);
	if (error) {
		g_warning (_("Error watching gconf key '%s': %s"), key, error->message);
		g_error_free (error);
	}
}
gboolean
panel_menu_button_create (PanelToplevel *toplevel,
			  int            position,
			  const char    *filename,
			  const char    *menu_path,
			  gboolean       use_menu_path,
			  const char    *tooltip)
{
	GConfClient *client;
	const char  *scheme;
	const char  *key;
	char        *id;

	client  = panel_gconf_get_client ();

	id = panel_profile_prepare_object (PANEL_OBJECT_MENU, toplevel, position, FALSE);

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "use_menu_path");
	gconf_client_set_bool (client, key, use_menu_path, NULL);

	scheme = panel_menu_filename_to_scheme (filename);

	if (filename && !scheme) {
		g_warning ("Failed to find menu scheme for %s\n", filename);
		g_free (id);
		return FALSE;
	}

	if (use_menu_path && menu_path && menu_path [0] && scheme) {
		char       *menu_uri;

		menu_uri = g_strconcat (scheme, ":", menu_path, NULL);

		key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "menu_path");
		gconf_client_set_string (client, key, menu_uri, NULL);

		g_free (menu_uri);
	}

	if (tooltip && tooltip [0]) {
		key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "tooltip");
		gconf_client_set_string (client, key, tooltip, NULL);
	}

	panel_profile_add_to_list (PANEL_GCONF_OBJECTS, id);
	g_free (id);

	return TRUE;
}
static void
panel_menu_button_connect_to_gconf (PanelMenuButton *button)
{
	GConfClient *client;
	const char  *key;

	client  = panel_gconf_get_client ();

	key = panel_gconf_sprintf (PANEL_CONFIG_DIR "/objects/%s",
				   button->priv->applet_id);
	gconf_client_add_dir (client, key, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
	button->priv->gconf_notify =
		gconf_client_notify_add (client, key,
					 (GConfClientNotifyFunc) panel_menu_button_gconf_notify,
					 button, NULL, NULL);
}
static void
panel_drawer_prepare (const char  *drawer_id,
		      const char  *custom_icon,
		      gboolean     use_custom_icon,
		      const char  *tooltip,
		      char       **attached_toplevel_id)
{
	GConfClient *client;
	const char  *key;

	client  = panel_gconf_get_client ();

	if (tooltip) {
		key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, drawer_id, "tooltip");
		gconf_client_set_string (client, key, tooltip, NULL);
	}

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, drawer_id, "use_custom_icon");
	gconf_client_set_bool (client, key, use_custom_icon, NULL);

	if (custom_icon) {
		key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, drawer_id, "custom_icon");
		gconf_client_set_string (client, key, custom_icon, NULL);
	}

	if (attached_toplevel_id) {
		char *toplevel_id;
		char *toplevel_dir;

		toplevel_id = panel_profile_find_new_id (PANEL_GCONF_TOPLEVELS);

		toplevel_dir = g_strdup_printf (PANEL_CONFIG_DIR "/toplevels/%s",
						toplevel_id);
		panel_gconf_associate_schemas_in_dir (client, toplevel_dir, PANEL_SCHEMAS_DIR "/toplevels");
	
		key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, drawer_id, "attached_toplevel_id");
		gconf_client_set_string (client, key, toplevel_id, NULL);
		
		key = panel_gconf_full_key (PANEL_GCONF_TOPLEVELS, toplevel_id, "enable_buttons");
		gconf_client_set_bool (client, key, TRUE, NULL);

		key = panel_gconf_full_key (PANEL_GCONF_TOPLEVELS, toplevel_id, "enable_arrows");
		gconf_client_set_bool (client, key, TRUE, NULL);

		*attached_toplevel_id = toplevel_id;
	}
}
void
panel_menu_button_load_from_gconf (PanelWidget *panel,
				   gboolean     locked,
				   int          position,
				   gboolean     exactpos,
				   const char  *id)
{
	GConfClient *client;
	const char  *key;
	char        *menu_path;
	char        *custom_icon;
	char        *tooltip;
	gboolean     use_menu_path;
	gboolean     use_custom_icon;

	client  = panel_gconf_get_client ();

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "menu_path");
	menu_path = gconf_client_get_string (client, key, NULL);

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "custom_icon");
	custom_icon = gconf_client_get_string (client, key, NULL);

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "tooltip");
	tooltip = gconf_client_get_string (client, key, NULL);

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "use_menu_path");
	use_menu_path = gconf_client_get_bool (client, key, NULL);

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "use_custom_icon");
	use_custom_icon = gconf_client_get_bool (client, key, NULL);

	panel_menu_button_load (menu_path,
				use_menu_path,
				custom_icon,
				use_custom_icon,
				tooltip,
				panel,
				locked,
				position,
				exactpos,
				id);

	g_free (menu_path);
	g_free (custom_icon);
	g_free (tooltip);
}
Example #10
0
void
drawer_load_from_gconf (PanelWidget *panel_widget,
			gboolean     locked,
			gint         position,
			const char  *id)
{
	GConfClient *client;
	const char  *key;
	gboolean     use_custom_icon;
	char        *toplevel_id;
	char        *custom_icon;
	char        *tooltip;

	g_return_if_fail (panel_widget != NULL);
	g_return_if_fail (id != NULL);

	client  = panel_gconf_get_client ();

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "attached_toplevel_id");
	toplevel_id = gconf_client_get_string (client, key, NULL);

	panel_profile_load_toplevel (client, PANEL_CONFIG_DIR, PANEL_GCONF_TOPLEVELS, toplevel_id);

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "use_custom_icon");
	use_custom_icon = gconf_client_get_bool (client, key, NULL);
	
	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "custom_icon");
	custom_icon = gconf_client_get_string (client, key, NULL);

	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "tooltip");
	tooltip = gconf_client_get_string (client, key, NULL);

	load_drawer_applet (toplevel_id,
			    custom_icon,
			    use_custom_icon,
			    tooltip,
			    panel_widget->toplevel,
			    locked,
			    position,
			    TRUE,
			    id);

	g_free (toplevel_id);
	g_free (custom_icon);
	g_free (tooltip);
}
static void
panel_menu_button_disconnect_from_gconf (PanelMenuButton *button)
{
	GConfClient *client;
	const char  *key;

	if (!button->priv->gconf_notify)
		return;

	client  = panel_gconf_get_client ();

	key = panel_gconf_sprintf (PANEL_CONFIG_DIR "/objects/%s",
				   button->priv->applet_id);

	gconf_client_notify_remove (client, button->priv->gconf_notify);
	button->priv->gconf_notify = 0;

	gconf_client_remove_dir (client, key, NULL);
}
void
panel_lockdown_finalize (void)
{
        GConfClient *client;
        GSList      *l;
        int          i;

        g_assert (panel_lockdown.initialized != FALSE);

        client = panel_gconf_get_client ();

        for (l = panel_lockdown.disabled_applets; l; l = l->next)
                g_free (l->data);
        g_slist_free (panel_lockdown.disabled_applets);
        panel_lockdown.disabled_applets = NULL;

        for (i = 0; i < N_LISTENERS; i++) {
                if (panel_lockdown.listeners [i])
                        gconf_client_notify_remove (client,
                                                    panel_lockdown.listeners [i]);
                panel_lockdown.listeners [i] = 0;
        }

        gconf_client_remove_dir (client,
                                 PANEL_GLOBAL_LOCKDOWN_DIR,
                                 NULL);

        gconf_client_remove_dir (client,
                                 DESKTOP_GNOME_LOCKDOWN_DIR,
                                 NULL);

        for (l = panel_lockdown.closures; l; l = l->next)
                g_closure_unref (l->data);
        g_slist_free (panel_lockdown.closures);
        panel_lockdown.closures = NULL;

        panel_lockdown.initialized = FALSE;
}
static void
panel_bindings_initialise (void)
{
	GConfClient *client;
	GError      *error;
	int          i;

	client = panel_gconf_get_client ();

	error = NULL;
	gconf_client_add_dir (client, BINDINGS_PREFIX,
			      GCONF_CLIENT_PRELOAD_ONELEVEL, &error);
	if (error) {
		g_warning (_("Error loading gconf directory '%s': %s"),
			   BINDINGS_PREFIX, error->message),
		g_error_free (error);
	}

	for (i = 0; i < G_N_ELEMENTS (bindings); i++) {
		const char *key;
		char       *str;

		key = panel_gconf_sprintf ("%s/%s", BINDINGS_PREFIX, bindings [i].key);

		error = NULL;
		str = gconf_client_get_string (client, key, &error);
		if (error) {
			g_warning (_("Error getting value for '%s': %s"),
				   error->message, key);
			continue;
		}

		panel_binding_set_from_string (&bindings [i], str);
		panel_binding_watch (&bindings [i], key);

		g_free (str);
	}
}
Example #14
0
static void
destroy_drawer (GtkWidget *widget,
		Drawer    *drawer)
{
	GConfClient *client;
	int          i;

	client = panel_gconf_get_client ();

	for (i = 0; i < PANEL_DRAWER_N_LISTENERS; i++) {
		if (drawer->listeners [i])
			gconf_client_notify_remove (client, drawer->listeners [i]);
		drawer->listeners [i] = 0;
	}

	if (drawer->toplevel)
		gtk_widget_destroy (GTK_WIDGET (drawer->toplevel));
	drawer->toplevel = NULL;

	if (drawer->close_timeout_id)
		g_source_remove (drawer->close_timeout_id);
	drawer->close_timeout_id = 0;
}
static void
panel_properties_dialog_free (PanelPropertiesDialog *dialog)
{
	GConfClient *client;

	client = panel_gconf_get_client ();

	if (dialog->toplevel_notify)
		gconf_client_notify_remove (client, dialog->toplevel_notify);
	dialog->toplevel_notify = 0;

	if (dialog->background_notify)
		gconf_client_notify_remove (client, dialog->background_notify);
	dialog->background_notify = 0;

	if (dialog->properties_dialog)
		gtk_widget_destroy (dialog->properties_dialog);
	dialog->properties_dialog = NULL;

	g_free (dialog->icon_theme_dir);
	dialog->icon_theme_dir = NULL;

	g_free (dialog);
}
void
panel_lockdown_init (void)
{
        GConfClient *client;
        int          i = 0;

        client = panel_gconf_get_client ();

        gconf_client_add_dir (client,
                              DESKTOP_GNOME_LOCKDOWN_DIR,
                              GCONF_CLIENT_PRELOAD_ONELEVEL,
                              NULL);

        gconf_client_add_dir (client,
                              PANEL_GLOBAL_LOCKDOWN_DIR,
                              GCONF_CLIENT_PRELOAD_ONELEVEL,
                              NULL);

        panel_lockdown.locked_down =
                panel_lockdown_load_bool (&panel_lockdown,
                                          client,
                                          PANEL_GLOBAL_LOCKED_DOWN_KEY,
                                          (GConfClientNotifyFunc) locked_down_notify,
                                          i++);

        panel_lockdown.disable_command_line =
                panel_lockdown_load_bool (&panel_lockdown,
                                          client,
                                          DISABLE_COMMAND_LINE_KEY,
                                          (GConfClientNotifyFunc) disable_command_line_notify,
                                          i++);
        
        panel_lockdown.disable_lock_screen =
                panel_lockdown_load_bool (&panel_lockdown,
                                          client,
                                          DISABLE_LOCK_SCREEN_KEY,
                                          (GConfClientNotifyFunc) disable_lock_screen_notify,
                                          i++);

        panel_lockdown.disable_log_out =
                panel_lockdown_load_bool (&panel_lockdown,
                                          client,
                                          DISABLE_LOG_OUT_KEY,
                                          (GConfClientNotifyFunc) disable_log_out_notify,
                                          i++);

        panel_lockdown.disable_force_quit =
                panel_lockdown_load_bool (&panel_lockdown,
                                          client,
                                          DISABLE_FORCE_QUIT_KEY,
                                          (GConfClientNotifyFunc) disable_force_quit_notify,
                                          i++);

        panel_lockdown.disabled_applets =
                panel_lockdown_load_disabled_applets (&panel_lockdown,
                                                      client,
                                                      i++);

        g_assert (i == N_LISTENERS);

        panel_lockdown.initialized = TRUE;
}
static GtkWidget *
panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
{
	GtkWidget *places_menu;
	GtkWidget *item;
	char      *gconf_name;
	char      *name;
	char      *uri;
	GFile     *file;

	places_menu = panel_create_menu ();

	file = g_file_new_for_path (g_get_home_dir ());
	uri = g_file_get_uri (file);
	name = panel_util_get_label_for_uri (uri);
	g_object_unref (file);
	
	panel_menu_items_append_place_item (PANEL_ICON_HOME, NULL,
					    name,
					    _("Open your personal folder"),
					    places_menu,
					    G_CALLBACK (activate_home_uri),
					    uri);
	g_free (name);
	g_free (uri);

	if (!gconf_client_get_bool (panel_gconf_get_client (),
				    DESKTOP_IS_HOME_DIR_KEY,
				    NULL)) {
		file = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
		uri = g_file_get_uri (file);
		g_object_unref (file);
		
		panel_menu_items_append_place_item (
				PANEL_ICON_DESKTOP, NULL,
				/* Translators: Desktop is used here as in
				 * "Desktop Folder" (this is not the Desktop
				 * environment). Do not keep "Desktop Folder|"
				 * in the translation */
				Q_("Desktop Folder|Desktop"),
				_("Open the contents of your desktop in a folder"),
				places_menu,
				G_CALLBACK (activate_desktop_uri),
				/* FIXME: if the dir changes, we'd need to update the drag data since the uri is not the same */
				uri);
		g_free (uri);
	}

	panel_place_menu_item_append_gtk_bookmarks (places_menu);
	add_menu_separator (places_menu);

	gconf_name = gconf_client_get_string (panel_gconf_get_client (),
					      COMPUTER_NAME_KEY,
					      NULL);
	panel_menu_items_append_from_desktop (places_menu,
					      "nautilus-computer.desktop",
					      gconf_name);
	if (gconf_name)
		g_free (gconf_name);

	panel_menu_items_append_from_desktop (places_menu,
					      "nautilus-cd-burner.desktop",
					      NULL);

	panel_place_menu_item_append_local_gio (place_item, places_menu);
	add_menu_separator (places_menu);

	panel_menu_items_append_from_desktop (places_menu,
					      "network-scheme.desktop",
					      NULL);
	panel_place_menu_item_append_remote_gio (place_item, places_menu);

	if (panel_is_program_in_path ("nautilus-connect-server")) {
		item = panel_menu_items_create_action_item (PANEL_ACTION_CONNECT_SERVER);
		if (item != NULL)
			gtk_menu_shell_append (GTK_MENU_SHELL (places_menu),
					       item);
	}

	add_menu_separator (places_menu);

	panel_menu_items_append_from_desktop (places_menu,
					      "gnome-search-tool.desktop",
					      NULL);

	panel_recent_append_documents_menu (places_menu,
					    place_item->priv->recent_manager);

	return places_menu;
}
static void
panel_place_menu_item_init (PanelPlaceMenuItem *menuitem)
{
	GFile *bookmark;
	char  *bookmarks_filename;
	GError *error;

	menuitem->priv = PANEL_PLACE_MENU_ITEM_GET_PRIVATE (menuitem);

	gconf_client_add_dir (panel_gconf_get_client (),
			      DESKTOP_IS_HOME_DIR_DIR,
			      GCONF_CLIENT_PRELOAD_NONE,
			      NULL);
	gconf_client_add_dir (panel_gconf_get_client (),
			      NAMES_DIR,
			      GCONF_CLIENT_PRELOAD_NONE,
			      NULL);

	panel_gconf_notify_add_while_alive (HOME_NAME_KEY,
					    (GConfClientNotifyFunc) panel_place_menu_item_key_changed,
					    G_OBJECT (menuitem));
	panel_gconf_notify_add_while_alive (DESKTOP_IS_HOME_DIR_KEY,
					    (GConfClientNotifyFunc) panel_place_menu_item_key_changed,
					    G_OBJECT (menuitem));
	panel_gconf_notify_add_while_alive (COMPUTER_NAME_KEY,
					    (GConfClientNotifyFunc) panel_place_menu_item_key_changed,
					    G_OBJECT (menuitem));

	menuitem->priv->recent_manager = gtk_recent_manager_get_default ();

	bookmarks_filename = g_build_filename (g_get_home_dir (),
					       BOOKMARKS_FILENAME, NULL);
	bookmark = g_file_new_for_path (bookmarks_filename);

	error = NULL;
	menuitem->priv->bookmarks_monitor = g_file_monitor_file 
        						(bookmark,
        						G_FILE_MONITOR_NONE,
        						NULL,
        						&error);
	if (error) {
		g_warning ("Failed to add file monitor for %s: %s\n",
			   bookmarks_filename, error->message);
		g_error_free (error);
	} else {
		g_signal_connect (G_OBJECT (menuitem->priv->bookmarks_monitor), 
				  "changed", 
				  (GCallback) panel_place_menu_item_gtk_bookmarks_changed,
				  menuitem);
	}

	g_object_unref (bookmark);
	g_free (bookmarks_filename);

	menuitem->priv->volume_monitor = g_volume_monitor_get ();

	menuitem->priv->drive_changed_id = g_signal_connect (menuitem->priv->volume_monitor,
							   "drive-changed",
							   G_CALLBACK (panel_place_menu_item_drives_changed),
							   menuitem);
	menuitem->priv->drive_connected_id = g_signal_connect (menuitem->priv->volume_monitor,
							     "drive-connected",
							     G_CALLBACK (panel_place_menu_item_drives_changed),
							     menuitem);
	menuitem->priv->drive_disconnected_id = g_signal_connect (menuitem->priv->volume_monitor,
							     "drive-disconnected",
							     G_CALLBACK (panel_place_menu_item_drives_changed),
							     menuitem);
	menuitem->priv->volume_added_id = g_signal_connect (menuitem->priv->volume_monitor,
							   "volume-added",
							   G_CALLBACK (panel_place_menu_item_volumes_changed),
							   menuitem);
	menuitem->priv->volume_changed_id = g_signal_connect (menuitem->priv->volume_monitor,
							     "volume-changed",
							     G_CALLBACK (panel_place_menu_item_volumes_changed),
							     menuitem);
	menuitem->priv->volume_removed_id = g_signal_connect (menuitem->priv->volume_monitor,
							     "volume-removed",
							     G_CALLBACK (panel_place_menu_item_volumes_changed),
							     menuitem);
	menuitem->priv->mount_added_id = g_signal_connect (menuitem->priv->volume_monitor,
							   "mount-added",
							   G_CALLBACK (panel_place_menu_item_mounts_changed),
							   menuitem);
	menuitem->priv->mount_changed_id = g_signal_connect (menuitem->priv->volume_monitor,
							     "mount-changed",
							     G_CALLBACK (panel_place_menu_item_mounts_changed),
							     menuitem);
	menuitem->priv->mount_removed_id = g_signal_connect (menuitem->priv->volume_monitor,
							     "mount-removed",
							     G_CALLBACK (panel_place_menu_item_mounts_changed),
							     menuitem);

}
static void
panel_place_menu_item_finalize (GObject *object)
{
	PanelPlaceMenuItem *menuitem = (PanelPlaceMenuItem *) object;

	gconf_client_remove_dir (panel_gconf_get_client (),
				 DESKTOP_IS_HOME_DIR_DIR,
				 NULL);
	gconf_client_remove_dir (panel_gconf_get_client (),
				 NAMES_DIR,
				 NULL);

	if (menuitem->priv->bookmarks_monitor != NULL) {
		g_file_monitor_cancel (menuitem->priv->bookmarks_monitor);
		g_object_unref (menuitem->priv->bookmarks_monitor);
	}
	menuitem->priv->bookmarks_monitor = NULL;

	if (menuitem->priv->drive_changed_id)
		g_signal_handler_disconnect (menuitem->priv->volume_monitor,
					     menuitem->priv->drive_changed_id);
	menuitem->priv->drive_changed_id = 0;

	if (menuitem->priv->drive_connected_id)
		g_signal_handler_disconnect (menuitem->priv->volume_monitor,
					     menuitem->priv->drive_connected_id);
	menuitem->priv->drive_connected_id = 0;

	if (menuitem->priv->drive_disconnected_id)
		g_signal_handler_disconnect (menuitem->priv->volume_monitor,
					     menuitem->priv->drive_disconnected_id);
	menuitem->priv->drive_disconnected_id = 0;

	if (menuitem->priv->volume_added_id)
		g_signal_handler_disconnect (menuitem->priv->volume_monitor,
					     menuitem->priv->volume_added_id);
	menuitem->priv->volume_added_id = 0;

	if (menuitem->priv->volume_changed_id)
		g_signal_handler_disconnect (menuitem->priv->volume_monitor,
					     menuitem->priv->volume_changed_id);
	menuitem->priv->volume_changed_id = 0;

	if (menuitem->priv->volume_removed_id)
		g_signal_handler_disconnect (menuitem->priv->volume_monitor,
					     menuitem->priv->volume_removed_id);
	menuitem->priv->volume_removed_id = 0;

	if (menuitem->priv->mount_added_id)
		g_signal_handler_disconnect (menuitem->priv->volume_monitor,
					     menuitem->priv->mount_added_id);
	menuitem->priv->mount_added_id = 0;

	if (menuitem->priv->mount_changed_id)
		g_signal_handler_disconnect (menuitem->priv->volume_monitor,
					     menuitem->priv->mount_changed_id);
	menuitem->priv->mount_changed_id = 0;

	if (menuitem->priv->mount_removed_id)
		g_signal_handler_disconnect (menuitem->priv->volume_monitor,
					     menuitem->priv->mount_removed_id);
	menuitem->priv->mount_removed_id = 0;

	if (menuitem->priv->volume_monitor != NULL)
		g_object_unref (menuitem->priv->volume_monitor);
	menuitem->priv->volume_monitor = NULL;

	G_OBJECT_CLASS (panel_place_menu_item_parent_class)->finalize (object);
}
Example #20
0
int
main (int argc, char **argv)
{
	GOptionContext *context;
	GnomeProgram   *program;

	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	context = g_option_context_new ("");
	g_option_context_set_ignore_unknown_options (context, TRUE);

	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);

	program = gnome_program_init ("gnome-panel", VERSION,
				      LIBGNOMEUI_MODULE,
				      argc, argv,
				      GNOME_PARAM_GOPTION_CONTEXT, context,
				      GNOME_PROGRAM_STANDARD_PROPERTIES,
				      NULL);

	gtk_window_set_default_icon_name ("gnome-panel");

	if (!panel_shell_register ())
		return -1;

	gnome_authentication_manager_init ();

	panel_tooltips = gtk_tooltips_new ();

	panel_action_protocol_init ();
	panel_multiscreen_init ();
	panel_init_stock_icons_and_items ();

	panel_session_init ();

	gconf_client_add_dir (panel_gconf_get_client (),
			      "/desktop/gnome/interface",
			      GCONF_CLIENT_PRELOAD_NONE,
			      NULL);

	panel_global_config_load ();
	panel_lockdown_init ();
	panel_profile_load ();

	/*add forbidden lists to ALL panels*/
	g_slist_foreach (panels,
			 (GFunc)panel_widget_add_forbidden,
			 NULL);

	xstuff_init ();

	gtk_main ();

	panel_lockdown_finalize ();

	gconf_client_remove_dir (panel_gconf_get_client (),
				 "/desktop/gnome/interface",
				 NULL);

	g_object_unref (program);

	return 0;
}