static GObject * cc_keyboard_panel_constructor (GType gtype, guint n_properties, GObjectConstructParam *properties) { GObject *obj; CcKeyboardPanel *self; CcKeyboardPanelPrivate *priv; GtkWidget *widget; obj = G_OBJECT_CLASS (cc_keyboard_panel_parent_class)->constructor (gtype, n_properties, properties); self = CC_KEYBOARD_PANEL (obj); priv = self->priv; keyboard_general_init (CC_PANEL (self), priv->builder); keyboard_shortcuts_init (CC_PANEL (self), priv->builder); widget = (GtkWidget *) gtk_builder_get_object (priv->builder, "keyboard_notebook"); gtk_widget_reparent (widget, (GtkWidget *) self); return obj; }
static void cc_keyboard_panel_dispose (GObject *object) { keyboard_general_dispose (CC_PANEL (object)); keyboard_shortcuts_dispose (CC_PANEL (object)); G_OBJECT_CLASS (cc_keyboard_panel_parent_class)->dispose (object); }
static void shell_test_button_clicked (GtkButton *button, CcMousePanel *panel) { CcMousePanelPrivate *priv = panel->priv; CcShell *shell; shell = cc_panel_get_shell (CC_PANEL (panel)); /* When running on a small screen, make the test dialog * the same height of the toplevel. */ if (cc_shell_is_small_screen (shell)) { gint height; gtk_window_get_size (GTK_WINDOW (cc_shell_get_toplevel (shell)), NULL, &height); gtk_widget_set_size_request (priv->test_dialog, -1, height); } else { gtk_widget_set_size_request (priv->test_widget, -1, TEST_WIDGET_DEFAULT_HEIGHT); } /* GTK_RESPONSE_NONE is returned if the dialog is being destroyed, so only * hide the dialog if it is not being destroyed */ if (gtk_dialog_run (GTK_DIALOG (priv->test_dialog)) != GTK_RESPONSE_NONE) gtk_widget_hide (priv->test_dialog); }
static void cc_search_panel_constructed (GObject *object) { CcSearchPanel *self = CC_SEARCH_PANEL (object); GtkWidget *box, *widget, *search_box; G_OBJECT_CLASS (cc_search_panel_parent_class)->constructed (object); /* add the disable all switch */ search_box = WID ("search_vbox"); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); widget = gtk_switch_new (); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 4); g_settings_bind (self->priv->search_settings, "disable-external", widget, "active", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN); g_object_bind_property (widget, "active", search_box, "sensitive", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); gtk_widget_show_all (box); cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (self)), box); }
static void cc_keyboard_panel_set_page (CcKeyboardPanel *panel, const gchar *page, const gchar *section) { GtkWidget *notebook; gint page_num; if (g_strcmp0 (page, "typing") == 0) page_num = TYPING_PAGE; else if (g_strcmp0 (page, "shortcuts") == 0) page_num = SHORTCUTS_PAGE; else { g_warning ("Could not switch to non-existent page '%s'", page); return; } notebook = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, "keyboard_notebook")); gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), page_num); if (page_num == SHORTCUTS_PAGE && section != NULL) { keyboard_shortcuts_set_section (CC_PANEL (panel), section); } }
void cc_network_panel_connect_to_3g_network (CcNetworkPanel *panel, NMClient *client, NMRemoteSettings *settings, NMDevice *device) { GtkWidget *toplevel = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel))); if (toplevel == NULL) { toplevel = GTK_WIDGET (panel); } MobileDialogClosure *closure; NMAMobileWizard *wizard; NMDeviceModemCapabilities caps; gboolean visible = FALSE; g_debug ("connect to 3g"); if (!NM_IS_DEVICE_MODEM (device)) { g_warning ("Network panel loaded with connect-3g but the selected device" " is not a modem"); return; } closure = g_slice_new (MobileDialogClosure); closure->client = g_object_ref (client); closure->settings = g_object_ref (settings); closure->device = g_object_ref (device); caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device)); if (caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) { wizard = nma_mobile_wizard_new (GTK_WINDOW (toplevel), NULL, NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS, FALSE, gsm_mobile_wizard_done, closure); if (wizard == NULL) { g_warning ("failed to construct GSM wizard"); return; } } else if (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO) { wizard = nma_mobile_wizard_new (GTK_WINDOW (toplevel), NULL, NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO, FALSE, cdma_mobile_wizard_done, closure); if (wizard == NULL) { g_warning ("failed to construct CDMA wizard"); return; } } else { g_warning ("Network panel loaded with connect-3g but the selected device" " does not support GSM or CDMA"); mobile_dialog_closure_free (closure); return; } g_object_get (G_OBJECT (toplevel), "visible", &visible, NULL); if (visible) { g_debug ("Scheduling showing the Mobile wizard"); g_idle_add ((GSourceFunc) show_wizard_idle_cb, wizard); } else { g_debug ("Will show wizard a bit later, toplevel is not visible"); g_signal_connect (G_OBJECT (toplevel), "notify::visible", G_CALLBACK (toplevel_shown), wizard); } }
static void on_info_bar_response (GtkInfoBar *info_bar, gint response_id, gpointer user_data) { GoaPanel *panel = GOA_PANEL (user_data); GtkTreeIter iter; if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->accounts_treeview)), NULL, &iter)) { GoaProvider *provider; const gchar *provider_type; GoaAccount *account; GoaObject *object; GtkWindow *parent; GError *error; gtk_tree_model_get (GTK_TREE_MODEL (panel->accounts_model), &iter, GOA_PANEL_ACCOUNTS_MODEL_COLUMN_OBJECT, &object, -1); account = goa_object_peek_account (object); provider_type = goa_account_get_provider_type (account); provider = goa_provider_get_for_provider_type (provider_type); parent = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel)))); error = NULL; if (!goa_provider_refresh_account (provider, panel->client, object, parent, &error)) { if (!(error->domain == GOA_ERROR && error->code == GOA_ERROR_DIALOG_DISMISSED)) { GtkWidget *dialog; dialog = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Error logging into the account")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message); gtk_widget_show_all (dialog); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } g_error_free (error); } g_object_unref (provider); g_object_unref (object); } }
static void cc_sharing_panel_constructed (GObject *object) { CcSharingPanelPrivate *priv = CC_SHARING_PANEL (object)->priv; G_OBJECT_CLASS (cc_sharing_panel_parent_class)->constructed (object); /* add the master switch */ cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (object)), gtk_widget_get_parent (priv->master_switch)); }
/* typing/keyboard section */ static gboolean typing_keyboard_preferences_clicked (GtkButton *button, CcUaPanel *panel) { CcShell *shell; shell = cc_panel_get_shell (CC_PANEL (panel)); cc_shell_set_active_panel_from_id (shell, "keyboard", NULL, NULL); return TRUE; }
/* mouse/pointing & clicking section */ static gboolean pointing_mouse_preferences_clicked_cb (GtkButton *button, CcUaPanel *panel) { CcShell *shell; shell = cc_panel_get_shell (CC_PANEL (panel)); cc_shell_set_active_panel_from_id (shell, "mouse", NULL, NULL); return TRUE; }
static void cc_bluetooth_panel_constructed (GObject *object) { CcBluetoothPanel *self = CC_BLUETOOTH_PANEL (object); G_OBJECT_CLASS (cc_bluetooth_panel_parent_class)->constructed (object); /* add kill switch widgets */ self->priv->kill_switch_header = g_object_ref (WID ("box_power")); cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (self)), self->priv->kill_switch_header); gtk_widget_show_all (self->priv->kill_switch_header); }
static void run_dialog (CcDateTimePanel *self, const gchar *dialog_name) { CcDateTimePanelPrivate *priv = self->priv; GtkWidget *dialog, *parent; dialog = W (dialog_name); parent = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self))); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent)); gtk_dialog_run (GTK_DIALOG (dialog)); }
static gboolean hearing_sound_preferences_clicked (GtkButton *button, CcUaPanel *panel) { CcShell *shell; shell = cc_panel_get_shell (CC_PANEL (panel)); if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0) cc_shell_set_active_panel_from_id (shell, "sound-nua", NULL, NULL); else cc_shell_set_active_panel_from_id (shell, "sound", NULL, NULL); return TRUE; }
static void panel_changed (GtkWidget *settings_widget, const char *panel, CcBluetoothPanel *self) { CcShell *shell; GError *error = NULL; shell = cc_panel_get_shell (CC_PANEL (self)); if (cc_shell_set_active_panel_from_id (shell, panel, NULL, &error) == FALSE) { g_warning ("Failed to activate '%s' panel: %s", panel, error->message); g_error_free (error); } }
void cc_wacom_panel_switch_to_panel (CcWacomPanel *self, const char *panel) { CcShell *shell; GError *error = NULL; g_return_if_fail (self); shell = cc_panel_get_shell (CC_PANEL (self)); if (cc_shell_set_active_panel_from_id (shell, panel, NULL, &error) == FALSE) { g_warning ("Failed to activate '%s' panel: %s", panel, error->message); g_error_free (error); } }
static void cc_mouse_panel_constructed (GObject *object) { CcMousePanel *self = CC_MOUSE_PANEL (object); CcMousePanelPrivate *priv = self->priv; GtkWidget *button, *container, *toplevel, *label; CcShell *shell; G_OBJECT_CLASS (cc_mouse_panel_parent_class)->constructed (object); /* Add test area button to shell header. */ shell = cc_panel_get_shell (CC_PANEL (self)); label = gtk_label_new_with_mnemonic (_("Test Your _Settings")); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); gtk_widget_show (label); button = gtk_button_new (); gtk_container_add (GTK_CONTAINER (button), label); gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button"); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_widget_set_visible (button, TRUE); cc_shell_embed_widget_in_header (shell, button); g_signal_connect (GTK_BUTTON (button), "clicked", G_CALLBACK (shell_test_button_clicked), self); toplevel = cc_shell_get_toplevel (shell); priv->test_dialog = g_object_new (GTK_TYPE_DIALOG, "title", _("Test Your Settings"), "transient-for", GTK_WINDOW (toplevel), "modal", TRUE, "use_header-bar", TRUE, "resizable", FALSE, NULL); container = gtk_dialog_get_content_area (GTK_DIALOG (priv->test_dialog)); gtk_container_add (GTK_CONTAINER (container), priv->test_widget); }
static void cc_sharing_panel_run_dialog (CcSharingPanel *self, const gchar *dialog_name) { CcSharingPanelPrivate *priv = self->priv; GtkWidget *dialog, *parent; dialog = WID (dialog_name); /* ensure labels with the hostname are updated if the hostname has changed */ cc_sharing_panel_setup_label_with_hostname (self, WID ("screen-sharing-label")); cc_sharing_panel_setup_label_with_hostname (self, WID ("remote-login-label")); cc_sharing_panel_setup_label_with_hostname (self, WID ("personal-file-sharing-label")); parent = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self))); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent)); gtk_dialog_run (GTK_DIALOG (dialog)); }
/* Add test area toggle to shell header. */ static gboolean add_shell_test_button_cb (gpointer user_data) { CcMousePanel *panel = CC_MOUSE_PANEL (user_data); GtkWidget *box, *button; box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); button = gtk_toggle_button_new_with_mnemonic (_("_Test Your Settings")); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); gtk_widget_set_visible (button, TRUE); cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (panel)), box); gtk_widget_set_visible (box, TRUE); panel->priv->shell_header = g_object_ref (box); g_signal_connect (GTK_BUTTON (button), "toggled", G_CALLBACK (shell_test_button_toggle_event), panel); return FALSE; }
static gboolean activate_panel (CinnamonControlCenter *shell, const gchar *id, const gchar **argv, const gchar *desktop_file, const gchar *name, GIcon *gicon) { CinnamonControlCenterPrivate *priv = shell->priv; GType panel_type = G_TYPE_INVALID; GList *panels, *l; GtkWidget *box; const gchar *icon_name; /* check if there is an plugin that implements this panel */ panels = g_io_extension_point_get_extensions (priv->extension_point); if (!desktop_file) return FALSE; if (!id) return FALSE; for (l = panels; l != NULL; l = l->next) { GIOExtension *extension; const gchar *name; extension = l->data; name = g_io_extension_get_name (extension); if (!g_strcmp0 (name, id)) { panel_type = g_io_extension_get_type (extension); break; } } if (panel_type == G_TYPE_INVALID) { GKeyFile *key_file; /* It might be an external panel */ key_file = g_key_file_new (); if (g_key_file_load_from_file (key_file, desktop_file, G_KEY_FILE_NONE, NULL)) { gchar *command; command = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL); if (command && command[0]) { g_spawn_command_line_async (command, NULL); g_free (command); } } g_key_file_free (key_file); return FALSE; } /* create the panel plugin */ priv->current_panel = g_object_new (panel_type, "shell", shell, "argv", argv, NULL); cc_shell_set_active_panel (CC_SHELL (shell), CC_PANEL (priv->current_panel)); gtk_widget_show (priv->current_panel); gtk_lock_button_set_permission (GTK_LOCK_BUTTON (priv->lock_button), cc_panel_get_permission (CC_PANEL (priv->current_panel))); box = gtk_alignment_new (0, 0, 1, 1); gtk_alignment_set_padding (GTK_ALIGNMENT (box), 6, 6, 6, 6); gtk_container_add (GTK_CONTAINER (box), priv->current_panel); gtk_widget_set_name (box, id); notebook_add_page (priv->notebook, box); /* switch to the new panel */ gtk_widget_show (box); notebook_select_page (priv->notebook, box); cc_shell_nav_bar_show_detail_button (CC_SHELL_NAV_BAR(shell->priv->nav_bar), name); /* set the title of the window */ icon_name = get_icon_name_from_g_icon (gicon); gtk_window_set_role (GTK_WINDOW (priv->window), id); gtk_window_set_title (GTK_WINDOW (priv->window), name); gtk_window_set_default_icon_name (icon_name); gtk_window_set_icon_name (GTK_WINDOW (priv->window), icon_name); priv->current_panel_box = box; return TRUE; }
static gboolean activate_panel (GnomeControlCenter *shell, const gchar *id, const gchar **argv, const gchar *desktop_file, const gchar *name, GIcon *gicon) { GDesktopAppInfo *appinfo; GdkAppLaunchContext *context; GdkScreen *screen; GdkDisplay *display; GError *error; appinfo = g_desktop_app_info_new_from_filename (desktop_file); screen = gtk_widget_get_screen (shell->priv->window); display = gdk_screen_get_display (screen); context = gdk_display_get_app_launch_context (display); gdk_app_launch_context_set_screen (context, screen); gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ()); error = NULL; g_app_info_launch_uris (G_APP_INFO (appinfo), NULL, (GAppLaunchContext *) context, &error); if (error) { g_printerr ("Could not launch '%s': %s\n", id, error->message); g_clear_error (&error); } g_object_unref (context); g_object_unref (appinfo); #if 0 GnomeControlCenterPrivate *priv = shell->priv; GType panel_type = G_TYPE_INVALID; GList *panels, *l; GtkWidget *box; const gchar *icon_name; /* check if there is an plugin that implements this panel */ panels = g_io_extension_point_get_extensions (priv->extension_point); if (!desktop_file) return FALSE; if (!id) return FALSE; for (l = panels; l != NULL; l = l->next) { GIOExtension *extension; const gchar *name; extension = l->data; name = g_io_extension_get_name (extension); if (!g_strcmp0 (name, id)) { panel_type = g_io_extension_get_type (extension); break; } } if (panel_type == G_TYPE_INVALID) { g_warning ("Could not find the loadable module for panel '%s'", id); return FALSE; } /* create the panel plugin */ priv->current_panel = g_object_new (panel_type, "shell", shell, "argv", argv, NULL); cc_shell_set_active_panel (CC_SHELL (shell), CC_PANEL (priv->current_panel)); gtk_widget_show (priv->current_panel); gtk_lock_button_set_permission (GTK_LOCK_BUTTON (priv->lock_button), cc_panel_get_permission (CC_PANEL (priv->current_panel))); box = gtk_alignment_new (0, 0, 1, 1); gtk_alignment_set_padding (GTK_ALIGNMENT (box), 6, 6, 6, 6); gtk_container_add (GTK_CONTAINER (box), priv->current_panel); gtk_widget_set_name (box, id); notebook_add_page (priv->notebook, box); /* switch to the new panel */ gtk_widget_show (box); notebook_select_page (priv->notebook, box); /* set the title of the window */ icon_name = get_icon_name_from_g_icon (gicon); gtk_window_set_role (GTK_WINDOW (priv->window), id); gtk_window_set_title (GTK_WINDOW (priv->window), name); gtk_window_set_default_icon_name (icon_name); gtk_window_set_icon_name (GTK_WINDOW (priv->window), icon_name); priv->current_panel_box = box; #endif return TRUE; }
static void add_account (GoaPanel *panel) { GtkWindow *parent; GtkWidget *dialog; gint response; GList *providers; GList *l; GoaObject *object; GError *error; providers = NULL; parent = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel)))); dialog = goa_panel_add_account_dialog_new (panel->client); gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); providers = goa_provider_get_all (); for (l = providers; l != NULL; l = l->next) { GoaProvider *provider; provider = GOA_PROVIDER (l->data); goa_panel_add_account_dialog_add_provider (GOA_PANEL_ADD_ACCOUNT_DIALOG (dialog), provider); } gtk_widget_show_all (dialog); response = gtk_dialog_run (GTK_DIALOG (dialog)); if (response != GTK_RESPONSE_OK) { gtk_widget_destroy (dialog); goto out; } error = NULL; object = goa_panel_add_account_dialog_get_account (GOA_PANEL_ADD_ACCOUNT_DIALOG (dialog), &error); gtk_widget_destroy (dialog); /* We might have an object even when error is set. * eg., if we failed to store the credentials in the keyring. */ if (object != NULL) { GtkTreeIter iter; /* navigate to newly created object */ if (goa_panel_accounts_model_get_iter_for_object (panel->accounts_model, object, &iter)) { gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->accounts_treeview)), &iter); } g_object_unref (object); } if (error != NULL) { if (!(error->domain == GOA_ERROR && error->code == GOA_ERROR_DIALOG_DISMISSED)) { dialog = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Error creating account")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message); gtk_widget_show_all (dialog); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } g_error_free (error); } out: g_list_foreach (providers, (GFunc) g_object_unref, NULL); g_list_free (providers); }
static void remove_account_cb (GoaAccount *account, GAsyncResult *res, gpointer user_data) { GoaPanel *panel = GOA_PANEL (user_data); GError *error; error = NULL; if (!goa_account_call_remove_finish (account, res, &error)) { GtkWidget *dialog; dialog = gtk_message_dialog_new (GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel)))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Error removing account")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message); gtk_widget_show_all (dialog); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); g_error_free (error); } g_object_unref (panel); }
static void on_toolbar_remove_button_clicked (GtkToolButton *button, gpointer user_data) { GoaPanel *panel = GOA_PANEL (user_data); GtkTreeIter iter; if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->accounts_treeview)), NULL, &iter)) { GoaObject *object; GtkWidget *dialog; gint response; gtk_tree_model_get (GTK_TREE_MODEL (panel->accounts_model), &iter, GOA_PANEL_ACCOUNTS_MODEL_COLUMN_OBJECT, &object, -1); dialog = gtk_message_dialog_new (GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel)))), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL, _("Are you sure you want to remove the account?")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("This will not remove the account on the server.")); gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Remove"), GTK_RESPONSE_OK); gtk_widget_show_all (dialog); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (response == GTK_RESPONSE_OK) { goa_account_call_remove (goa_object_peek_account (object), NULL, /* GCancellable */ (GAsyncReadyCallback) remove_account_cb, g_object_ref (panel)); } g_object_unref (object); } }
static gboolean activate_panel (GnomeControlCenter *shell, const gchar *id, const gchar **argv, const gchar *desktop_file, const gchar *name, GIcon *gicon) { GnomeControlCenterPrivate *priv = shell->priv; GType panel_type = G_TYPE_INVALID; GList *panels, *l; GtkWidget *panel; GtkWidget *box; const gchar *icon_name; /* check if there is an plugin that implements this panel */ panels = g_io_extension_point_get_extensions (priv->extension_point); if (!desktop_file) return FALSE; if (!id) return FALSE; for (l = panels; l != NULL; l = l->next) { GIOExtension *extension; const gchar *name; extension = l->data; name = g_io_extension_get_name (extension); if (!g_strcmp0 (name, id)) { panel_type = g_io_extension_get_type (extension); break; } } if (panel_type == G_TYPE_INVALID) { g_warning ("Could not find the loadable module for panel '%s'", id); return FALSE; } /* create the panel plugin */ panel = g_object_new (panel_type, "shell", shell, "argv", argv, NULL); cc_shell_set_active_panel (CC_SHELL (shell), CC_PANEL (panel)); gtk_widget_show (panel); gtk_lock_button_set_permission (GTK_LOCK_BUTTON (priv->lock_button), cc_panel_get_permission (CC_PANEL (panel))); box = gtk_alignment_new (0, 0, 1, 1); gtk_alignment_set_padding (GTK_ALIGNMENT (box), 6, 6, 6, 6); gtk_container_add (GTK_CONTAINER (box), panel); gtk_widget_set_name (box, id); notebook_add_page (priv->notebook, box); /* switch to the new panel */ gtk_widget_show (box); notebook_select_page (priv->notebook, box); /* set the title of the window */ icon_name = get_icon_name_from_g_icon (gicon); gtk_window_set_role (GTK_WINDOW (priv->window), id); gtk_window_set_title (GTK_WINDOW (priv->window), name); gtk_window_set_default_icon_name (icon_name); gtk_window_set_icon_name (GTK_WINDOW (priv->window), icon_name); priv->current_panel = box; return TRUE; }