static void xfce_keyboard_layout_helper_init (XfceKeyboardLayoutHelper *helper) { /* init */ helper->channel = NULL; /* open the channel */ helper->channel = xfconf_channel_get ("keyboard-layout"); helper->xkb_disable_settings = xfconf_channel_get_bool (helper->channel, "/Default/XkbDisable", TRUE); #ifdef HAVE_LIBXKLAVIER /* monitor channel changes */ g_signal_connect (G_OBJECT (helper->channel), "property-changed", G_CALLBACK (xfce_keyboard_layout_helper_channel_property_changed), helper); helper->engine = xkl_engine_get_instance (GDK_DISPLAY ()); helper->config = xkl_config_rec_new (); xkl_config_rec_get_from_server (helper->config, helper->engine); helper->system_keyboard_model = g_strdup (helper->config->model); gdk_window_add_filter (NULL, (GdkFilterFunc) handle_xevent, helper); g_signal_connect (helper->engine, "X-new-device", G_CALLBACK (xfce_keyboard_layout_reset_xkl_config), helper); xkl_engine_start_listen (helper->engine, XKLL_TRACK_KEYBOARD_STATE); /* load settings */ xfce_keyboard_layout_helper_set_model (helper); xfce_keyboard_layout_helper_set_layout (helper); xfce_keyboard_layout_helper_set_variant (helper); xfce_keyboard_layout_helper_set_grpkey (helper); xfce_keyboard_layout_helper_set_composekey (helper); #endif /* HAVE_LIBXKLAVIER */ xfce_keyboard_layout_helper_process_xmodmap (); }
/* Object initialization * Create private structure and set up default values */ static void xfdashboard_settings_init(XfdashboardSettings *self) { XfdashboardSettingsPrivate *priv; priv=self->priv=XFDASHBOARD_SETTINGS_GET_PRIVATE(self); /* Set default values */ priv->xfconfChannel=xfconf_channel_get(XFDASHBOARD_XFCONF_CHANNEL); priv->builder=NULL; priv->widgetCloseButton=NULL; priv->widgetResetSearchOnResume=NULL; priv->widgetSwitchViewOnResume=NULL; priv->widgetNotificationTimeout=NULL; priv->widgetEnableUnmappedWindowWorkaround=NULL; priv->widgetScrollEventChangedWorkspace=NULL; priv->widgetThemes=NULL; priv->widgetThemeScreenshot=NULL; priv->widgetThemeNameLabel=NULL; priv->widgetThemeName=NULL; priv->widgetThemeAuthorLabel=NULL; priv->widgetThemeAuthor=NULL; priv->widgetThemeVersionLabel=NULL; priv->widgetThemeVersion=NULL; priv->widgetThemeDescriptionLabel=NULL; priv->widgetThemeDescription=NULL; }
XfconfChannel * wck_properties_get_channel (GObject *object_for_weak_ref, const gchar *channel_name) { GError *error = NULL; XfconfChannel *channel; g_return_val_if_fail (G_IS_OBJECT (object_for_weak_ref), NULL); if (!xfconf_init (&error)) { g_critical ("Failed to initialize Xfconf: %s", error->message); g_error_free (error); return NULL; } //~ channel = xfconf_channel_get (XFCE_PANEL_CHANNEL_NAME); channel = xfconf_channel_get (channel_name); g_object_weak_ref (object_for_weak_ref, (GWeakNotify) xfconf_shutdown, NULL); return channel; }
static void xfce_accessibility_helper_init (XfceAccessibilityHelper *helper) { gint dummy; helper->channel = NULL; #ifdef HAVE_LIBNOTIFY helper->notification = NULL; #endif /* !HAVE_LIBNOTIFY */ if (XkbQueryExtension (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &dummy, &dummy, &dummy, &dummy, &dummy)) { /* open the channel */ helper->channel = xfconf_channel_get ("accessibility"); /* monitor channel changes */ g_signal_connect (G_OBJECT (helper->channel), "property-changed", G_CALLBACK (xfce_accessibility_helper_channel_property_changed), helper); /* restore the xbd configuration */ xfce_accessibility_helper_set_xkb (helper, XkbStickyKeysMask | XkbSlowKeysMask | XkbBounceKeysMask | XkbMouseKeysMask | XkbAccessXKeysMask); #ifdef HAVE_LIBNOTIFY /* setup a connection with the notification daemon */ if (!notify_init ("xfce4-settings-helper")) g_critical ("Failed to connect to the notification daemon."); /* add event filter */ XkbSelectEvents (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbUseCoreKbd, XkbControlsNotifyMask, XkbControlsNotifyMask); /* monitor all window events */ gdk_window_add_filter (NULL, xfce_accessibility_helper_event_filter, helper); #endif /* !HAVE_LIBNOTIFY */ } else { /* warning */ g_critical ("Failed to initialize the Accessibility extension."); } }
/* Perform full initialization of this application instance */ static gboolean _xfdashboard_application_initialize_full(XfdashboardApplication *self, XfdashboardStage **outStage) { XfdashboardApplicationPrivate *priv; GError *error; ClutterActor *stage; #if !GARCON_CHECK_VERSION(0,3,0) const gchar *desktop; #endif g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION(self), FALSE); g_return_val_if_fail(outStage==NULL || *outStage==NULL, FALSE); priv=self->priv; error=NULL; /* Initialize garcon for current desktop environment */ #if !GARCON_CHECK_VERSION(0,3,0) desktop=g_getenv("XDG_CURRENT_DESKTOP"); if(G_LIKELY(desktop==NULL)) { /* If we could not determine current desktop environment * assume Xfce as this application is developed for this DE. */ desktop="XFCE"; } /* If desktop enviroment was found but has no name * set NULL to get all menu items shown. */ else if(*desktop==0) desktop=NULL; garcon_set_environment(desktop); #else garcon_set_environment_xdg(GARCON_ENVIRONMENT_XFCE); #endif /* Setup the session management */ priv->sessionManagementClient=xfce_sm_client_get(); xfce_sm_client_set_priority(priv->sessionManagementClient, XFCE_SM_CLIENT_PRIORITY_DEFAULT); xfce_sm_client_set_restart_style(priv->sessionManagementClient, XFCE_SM_CLIENT_RESTART_IMMEDIATELY); g_signal_connect_swapped(priv->sessionManagementClient, "quit", G_CALLBACK(_xfdashboard_application_on_session_quit), self); if(!xfce_sm_client_connect(priv->sessionManagementClient, &error)) { g_warning("Failed to connect to session manager: %s", (error && error->message) ? error->message : _("unknown error")); g_clear_error(&error); } /* Initialize xfconf */ if(!xfconf_init(&error)) { g_critical(_("Could not initialize xfconf: %s"), (error && error->message) ? error->message : _("unknown error")); if(error) g_error_free(error); return(FALSE); } priv->xfconfChannel=xfconf_channel_get(XFDASHBOARD_XFCONF_CHANNEL); /* Set up keyboard and pointer bindings */ priv->bindings=xfdashboard_bindings_pool_get_default(); if(!priv->bindings) { g_critical(_("Could not initialize bindings")); return(FALSE); } if(!xfdashboard_bindings_pool_load(priv->bindings, &error)) { g_critical(_("Could not load bindings: %s"), (error && error->message) ? error->message : _("unknown error")); if(error!=NULL) g_error_free(error); return(FALSE); } /* Set up application database */ priv->appDatabase=xfdashboard_application_database_get_default(); if(!priv->appDatabase) { g_critical(_("Could not initialize application database")); return(FALSE); } if(!xfdashboard_application_database_load(priv->appDatabase, &error)) { g_critical(_("Could not load application database: %s"), (error && error->message) ? error->message : _("unknown error")); if(error!=NULL) g_error_free(error); return(FALSE); } /* Set up application tracker */ priv->appTracker=xfdashboard_application_tracker_get_default(); if(!priv->appTracker) { g_critical(_("Could not initialize application tracker")); return(FALSE); } /* Set up and load theme */ priv->xfconfThemeChangedSignalID=xfconf_g_property_bind(priv->xfconfChannel, THEME_NAME_XFCONF_PROP, G_TYPE_STRING, self, "theme-name"); if(!priv->xfconfThemeChangedSignalID) { g_warning(_("Could not create binding between xfconf property and local resource for theme change notification.")); } /* Set up default theme in Xfcond if property in channel does not exist * because it indicates first start. */ if(!xfconf_channel_has_property(priv->xfconfChannel, THEME_NAME_XFCONF_PROP)) { xfconf_channel_set_string(priv->xfconfChannel, THEME_NAME_XFCONF_PROP, DEFAULT_THEME_NAME); } /* At this time the theme must have been loaded, either because we * set the default theme name because of missing theme property in * xfconf channel or the value of xfconf channel property has been read * and set when setting up binding (between xfconf property and local property) * what caused a call to function to set theme name in this object * and also caused a reload of theme. * So if no theme object is set in this object then loading theme has * failed and we have to return FALSE. */ if(!priv->theme) return(FALSE); /* Register built-in views (order of registration is important) */ priv->viewManager=xfdashboard_view_manager_get_default(); xfdashboard_view_manager_register(priv->viewManager, XFDASHBOARD_TYPE_WINDOWS_VIEW); xfdashboard_view_manager_register(priv->viewManager, XFDASHBOARD_TYPE_APPLICATIONS_VIEW); xfdashboard_view_manager_register(priv->viewManager, XFDASHBOARD_TYPE_SEARCH_VIEW); /* Register built-in search providers */ priv->searchManager=xfdashboard_search_manager_get_default(); xfdashboard_search_manager_register(priv->searchManager, XFDASHBOARD_TYPE_APPLICATIONS_SEARCH_PROVIDER); /* Create single-instance of focus manager to keep it alive while * application is running. */ priv->focusManager=xfdashboard_focus_manager_get_default(); /* Create stage containing all monitors */ stage=xfdashboard_stage_new(); g_signal_connect_swapped(stage, "delete-event", G_CALLBACK(_xfdashboard_application_on_delete_stage), self); /* Emit signal 'theme-changed' to get current theme loaded at each stage created */ g_signal_emit(self, XfdashboardApplicationSignals[SIGNAL_THEME_CHANGED], 0, priv->theme); /* Set return results */ if(outStage) *outStage=XFDASHBOARD_STAGE(stage); /* Initialization was successful so return TRUE */ #ifdef DEBUG xfdashboard_notify(NULL, NULL, _("Welcome to %s (%s)!"), PACKAGE_NAME, PACKAGE_VERSION); #else xfdashboard_notify(NULL, NULL, _("Welcome to %s!"), PACKAGE_NAME); #endif return(TRUE); }
gint main (gint argc, gchar **argv) { GError *error = NULL; GtkWidget *dialog; GtkWidget *button; gint result; gint retval = EXIT_SUCCESS; gint default_response = GTK_RESPONSE_CANCEL; XfconfChannel *channel; gint configver; gchar *filename_46; gchar *filename_default; gboolean migrate_vendor_default; /* set translation domain */ lde_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); #ifndef NDEBUG /* terminate the program on warnings and critical messages */ g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING); #endif gtk_init (&argc, &argv); if (!xfconf_init (&error)) { g_critical ("Failed to initialize Xfconf: %s", error->message); g_error_free (error); return EXIT_FAILURE; } channel = xfconf_channel_get (LDE_PANEL_CHANNEL_NAME); if (!xfconf_channel_has_property (channel, "/panels")) { /* lookup the old 4.6 config file */ filename_46 = lde_resource_lookup (LDE_RESOURCE_CONFIG, LDE_46_CONFIG); /* lookup the default configuration */ lde_resource_push_path (LDE_RESOURCE_CONFIG, XDGCONFIGDIR); filename_default = lde_resource_lookup (LDE_RESOURCE_CONFIG, DEFAULT_CONFIG_FILENAME); lde_resource_pop_path (LDE_RESOURCE_CONFIG); if (filename_46 == NULL && filename_default == NULL) { g_warning ("No default or old configuration found"); return EXIT_FAILURE; } /* if the default configuration does not match with the file found * by the resource lookup, migrate it without asking */ migrate_vendor_default = (g_strcmp0 (DEFAULT_CONFIG_PATH, filename_default) != 0); /* check if we auto-migrate the default configuration */ if (g_getenv ("LDE_PANEL_MIGRATE_DEFAULT") != NULL || migrate_vendor_default) { if (filename_46 != NULL) g_message ("Tried to auto-migrate, but old configuration found"); else if (filename_default == NULL) g_message ("Tried to auto-migrate, but no default configuration found"); else goto migrate_default; } /* create question dialog */ dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Welcome to the first start of the panel")); gtk_window_set_title (GTK_WINDOW (dialog), _("Panel")); gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_PREFERENCES); gtk_window_stick (GTK_WINDOW (dialog)); gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE); if (filename_46 != NULL) { gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s\n%s", _("Because the panel moved to a new system for storing the " "settings, it has to load a fresh initial configuration."), _("Choose below which setup you want for the first startup.")); button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("Migrate old config"), GTK_RESPONSE_OK); gtk_widget_set_tooltip_text (button, _("Migrate the old 4.6 configuration to Xfconf")); default_response = GTK_RESPONSE_OK; } else { gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("Choose below which setup you want for the first startup.")); } if (filename_default != NULL) { button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("Use default config"), GTK_RESPONSE_YES); gtk_widget_set_tooltip_text (button, _("Load the default configuration")); if (default_response == GTK_RESPONSE_CANCEL) default_response = GTK_RESPONSE_YES; } button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("One empty panel"), GTK_RESPONSE_CANCEL); gtk_widget_set_tooltip_text (button, _("Start with one empty panel")); gtk_dialog_set_default_response (GTK_DIALOG (dialog), default_response); result = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (result == GTK_RESPONSE_OK && filename_46 != NULL) { /* restore 4.6 config */ if (!migrate_46 (filename_46, channel, &error)) { lde_dialog_show_error (NULL, error, _("Failed to migrate the old panel configuration")); g_error_free (error); retval = EXIT_FAILURE; } } else if (result == GTK_RESPONSE_YES && filename_default != NULL) { migrate_default: /* apply default config */ if (!migrate_default (filename_default, &error)) { lde_dialog_show_error (NULL, error, _("Failed to load the default configuration")); g_error_free (error); retval = EXIT_FAILURE; } } g_free (filename_46); g_free (filename_default); } configver = xfconf_channel_get_int (channel, "/configver", -1); if (configver < LDE4_PANEL_CONFIG_VERSION) { g_message (_("Panel config needs migration...")); if (!migrate_config (channel, configver, &error)) { lde_dialog_show_error (NULL, error, _("Failed to migrate the existing configuration")); g_error_free (error); retval = EXIT_FAILURE; } else { g_message (_("Panel configuration has been updated.")); } /* migration complete, set new version */ xfconf_channel_set_int (channel, "/configver", LDE4_PANEL_CONFIG_VERSION); } xfconf_shutdown (); return retval; }
int main(int argc, char **argv) { GtkBuilder *builder; GtkWidget *notebook, *xfae_page, *lbl; GError *error = NULL; XfconfChannel *channel; xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8"); if(!gtk_init_with_args (&argc, &argv, "", option_entries, GETTEXT_PACKAGE, &error)) { if(G_LIKELY(error)) { g_print("%s: %s.\n", G_LOG_DOMAIN, error->message); g_print(_("Type '%s --help' for usage."), G_LOG_DOMAIN); g_print("\n"); g_error_free (error); } else g_error("Unable to open display."); return EXIT_FAILURE; } if(G_UNLIKELY(opt_version)) { g_print("%s %s (Xfce %s)\n\n", G_LOG_DOMAIN, PACKAGE_VERSION, xfce_version_string ()); g_print("%s\n", "Copyright (c) 2004-2014"); g_print("\t%s\n\n", _("The Xfce development team. All rights reserved.")); g_print(_("Please report bugs to <%s>."), PACKAGE_BUGREPORT); g_print("\n"); return EXIT_SUCCESS; } if(G_UNLIKELY(!xfconf_init(&error))) { xfce_dialog_show_error (NULL, error, _("Unable to contact settings server")); g_error_free(error); return EXIT_FAILURE; } gtk_window_set_default_icon_name("xfce4-session"); /* hook to make sure the libxfce4ui library is linked */ if (xfce_titled_dialog_get_type() == 0) return EXIT_FAILURE; builder = gtk_builder_new(); gtk_builder_add_from_string(builder, xfce4_session_settings_ui, xfce4_session_settings_ui_length, &error); if(!builder) { xfce_dialog_show_error(NULL, error, _("Unable to create user interface from embedded definition data")); g_error_free (error); return EXIT_FAILURE; } splash_settings_init(builder); session_editor_init(builder); /* FIXME: someday, glade-ify this, maybe. */ xfae_page = xfae_window_new(); gtk_widget_show(xfae_page); notebook = GTK_WIDGET(gtk_builder_get_object(builder, "plug-child")); lbl = gtk_label_new_with_mnemonic(_("App_lication Autostart")); gtk_widget_show(lbl); gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), xfae_page, lbl, 2); channel = xfconf_channel_get(SETTINGS_CHANNEL); /* bind widgets to xfconf */ xfconf_g_property_bind(channel, "/chooser/AlwaysDisplay", G_TYPE_BOOLEAN, gtk_builder_get_object(builder, "chk_display_chooser"), "active"); xfconf_g_property_bind(channel, "/general/AutoSave", G_TYPE_BOOLEAN, gtk_builder_get_object(builder, "chk_session_autosave"), "active"); xfconf_g_property_bind(channel, "/general/PromptOnLogout", G_TYPE_BOOLEAN, gtk_builder_get_object(builder, "chk_logout_prompt"), "active"); xfconf_g_property_bind(channel, "/compat/LaunchGNOME", G_TYPE_BOOLEAN, gtk_builder_get_object(builder, "chk_compat_gnome"), "active"); xfconf_g_property_bind(channel, "/compat/LaunchKDE", G_TYPE_BOOLEAN, gtk_builder_get_object(builder, "chk_compat_kde"), "active"); xfconf_g_property_bind(channel, "/security/EnableTcp", G_TYPE_BOOLEAN, gtk_builder_get_object(builder, "chk_enable_tcp"), "active"); xfconf_g_property_bind(channel, "/shutdown/LockScreen", G_TYPE_BOOLEAN, gtk_builder_get_object(builder, "chk_lock_screen"), "active"); if(G_UNLIKELY(opt_socket_id == 0)) { GtkWidget *dialog = GTK_WIDGET(gtk_builder_get_object(builder, "xfce4_session_settings_dialog")); g_signal_connect(dialog, "response", G_CALLBACK(xfce4_session_settings_dialog_response), NULL); g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_main_quit), NULL); gtk_widget_show(dialog); /* To prevent the settings dialog to be saved in the session */ gdk_set_sm_client_id ("FAKE ID"); gtk_main(); } else { GtkWidget *plug, *plug_child; plug = gtk_plug_new(opt_socket_id); gtk_widget_show(plug); g_signal_connect(plug, "delete-event", G_CALLBACK(gtk_main_quit), NULL); plug_child = GTK_WIDGET(gtk_builder_get_object(builder, "plug-child")); gtk_widget_reparent(plug_child, plug); gtk_widget_show(plug_child); /* Stop startup notification */ gdk_notify_startup_complete(); gtk_main(); } g_object_unref(builder); return EXIT_SUCCESS; }
PlacesCfg* places_cfg_new(XfcePanelPlugin *plugin) { PlacesCfg *cfg; XfconfChannel *channel; gchar *property; cfg = g_object_new (XFCE_TYPE_PLACES_CFG, NULL); cfg->plugin = plugin; xfconf_init(NULL); channel = xfconf_channel_get ("xfce4-panel"); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-button-type", NULL); xfconf_g_property_bind (channel, property, G_TYPE_INT, cfg, "show-button-type"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/button-label", NULL); xfconf_g_property_bind (channel, property, G_TYPE_STRING, cfg, "button-label"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-icons", NULL); xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-icons"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-volumes", NULL); xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-volumes"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/mount-open-volumes", NULL); xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "mount-open-volumes"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-bookmarks", NULL); xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-bookmarks"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/server-connect-cmd", NULL); xfconf_g_property_bind (channel, property, G_TYPE_STRING, cfg, "server-connect-cmd"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/network-cmd", NULL); xfconf_g_property_bind (channel, property, G_TYPE_STRING, cfg, "network-cmd"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-recent", NULL); xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-recent"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-recent-clear", NULL); xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, cfg, "show-recent-clear"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/show-recent-number", NULL); xfconf_g_property_bind (channel, property, G_TYPE_INT, cfg, "show-recent-number"); g_free (property); property = g_strconcat (xfce_panel_plugin_get_property_base (plugin), "/search-cmd", NULL); xfconf_g_property_bind (channel, property, G_TYPE_STRING, cfg, "search-cmd"); g_free (property); g_signal_connect_swapped(G_OBJECT(plugin), "configure-plugin", G_CALLBACK(places_cfg_open_dialog), cfg); xfce_panel_plugin_menu_show_configure(plugin); return cfg; }
static void power_manager_plugin_configure (XfcePanelPlugin *plugin, PowerManagerPlugin *power_manager_plugin) { GtkWidget *dialog; GtkWidget *grid, *combo, *label; gint show_panel_label; XfconfChannel *channel; GtkListStore *list_store; GtkTreeIter iter, active_iter; GtkCellRenderer *cell; gint i; gchar *options[] = { _("None"), _("Percentage"), _("Remaining time"), _("Percentage and remaining time") }; channel = xfconf_channel_get (XFPM_CHANNEL); /* block the plugin menu */ xfce_panel_plugin_block_menu (plugin); /* create the dialog */ dialog = xfce_titled_dialog_new_with_buttons (_("Power Manager Plugin Settings"), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))), GTK_DIALOG_DESTROY_WITH_PARENT, "gtk-help", GTK_RESPONSE_HELP, "gtk-close", GTK_RESPONSE_OK, NULL); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); gtk_window_set_icon_name (GTK_WINDOW (dialog), "xfce4-power-manager-settings"); gtk_widget_show (dialog); /* Set up the main grid for all settings */ grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 12); gtk_widget_set_margin_start (grid, 12); gtk_widget_set_margin_end (grid, 12); gtk_widget_set_margin_top (grid, 12); gtk_widget_set_margin_bottom (grid, 12); gtk_container_add_with_properties (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid, "expand", TRUE, "fill", TRUE, NULL); /* show-panel-label setting */ label = gtk_label_new (_("Show label:")); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (label), 0, 0, 1, 1); show_panel_label = xfconf_channel_get_int (channel, XFPM_PROPERTIES_PREFIX SHOW_PANEL_LABEL, -1); list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_INT, G_TYPE_STRING); for (i = 0; i < 4; i++) { gtk_list_store_append (list_store, &iter); gtk_list_store_set (list_store, &iter, COLUMN_INT, i, COLUMN_STRING, options[i], -1); if (i == show_panel_label) active_iter = iter; } combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (list_store)); cell = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE ); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, "text", COLUMN_STRING, NULL); gtk_combo_box_set_id_column (GTK_COMBO_BOX (combo), COLUMN_STRING); gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &active_iter); gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (combo), 1, 0, 1, 1); g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (power_manager_plugin_combo_changed), channel); g_signal_connect (G_OBJECT (channel), "property-changed::" XFPM_PROPERTIES_PREFIX SHOW_PANEL_LABEL, G_CALLBACK (power_manager_plugin_panel_label_changed), combo); /* link the dialog to the plugin, so we can destroy it when the plugin * is closed, but the dialog is still open */ g_object_set_data (G_OBJECT (plugin), "dialog", dialog); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK(power_manager_plugin_configure_response), power_manager_plugin); gtk_widget_show_all (grid); }