diff options
author | Stefano Karapetsas <[email protected]> | 2012-11-13 12:12:33 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-11-13 12:12:33 +0100 |
commit | 0f3f63d973b8084e936dccad13ccf4f683ec0ce8 (patch) | |
tree | d54d84ba0ef5aac6503f4c569d8a8a5ed2419e00 | |
parent | 7b5a0590dec1342bc64b4d3372498ded5a7d06ac (diff) | |
download | mate-netbook-0f3f63d973b8084e936dccad13ccf4f683ec0ce8.tar.bz2 mate-netbook-0f3f63d973b8084e936dccad13ccf4f683ec0ce8.tar.xz |
mate-window-picker-applet: migrate to gsettings
5 files changed, 36 insertions, 61 deletions
diff --git a/mate-window-picker-applet/Makefile.am b/mate-window-picker-applet/Makefile.am index 20b39bd..74d642b 100644 --- a/mate-window-picker-applet/Makefile.am +++ b/mate-window-picker-applet/Makefile.am @@ -45,10 +45,12 @@ org.mate.panel.applet.MateWindowPickerFactory.service: $(service_in_files) -e "s|\@LOCATION\@|$(APPLET_LOCATION)|" \ $< > $@ -schemasdir = @MATECONF_SCHEMA_FILE_DIR@ -schemas_in_files = mate-window-picker-applet.schemas.in -schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) -@INTLTOOL_SCHEMAS_RULE@ +@INTLTOOL_XML_NOMERGE_RULE@ +gsettings_SCHEMAS = org.mate.panel.applet.mate-window-picker-applet.gschema.xml +@GSETTINGS_RULES@ + +%.gschema.xml.in: %.gschema.xml.in.in Makefile + $(AM_V_GEN) $(SED) -e 's^\@GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' < $< > $@ xmluidir = $(datadir)/mate-panel/ui xmlui_DATA = mate-window-picker-applet-menu.xml @@ -57,9 +59,9 @@ EXTRA_DIST = \ org.mate.panel.MateWindowPicker.panel-applet.in.in \ $(service_in_files) \ $(ui_DATA) \ - $(schemas_in_files) + $(gsettings_SCHEMAS_in_in) -CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(schemas_DATA) +CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS_in) $(gsettings_SCHEMAS) clean: rm -f $(desktop_DATA) $(desktop_DATA).in $(server_DATA) $(server_DATA).in diff --git a/mate-window-picker-applet/applet.c b/mate-window-picker-applet/applet.c index c2b33a6..509bfbb 100644 --- a/mate-window-picker-applet/applet.c +++ b/mate-window-picker-applet/applet.c @@ -30,20 +30,22 @@ #include <libmatewnck/libmatewnck.h> +#include <gio/gio.h> #include <mate-panel-applet.h> -#include <mate-panel-applet-mateconf.h> -#include <mateconf/mateconf-client.h> +#include <mate-panel-applet-gsettings.h> #include "task-list.h" #include "task-title.h" -#define SHOW_WIN_KEY "show_all_windows" +#define APPLET_SCHEMA "org.mate.panel.applet.mate-window-picker-applet" +#define SHOW_WIN_KEY "show-all-windows" typedef struct { GtkWidget *tasks; GtkWidget *applet; GtkWidget *title; + GSettings *settings; } WinPickerApp; @@ -76,9 +78,8 @@ static const gchar *close_window_authors [] = { }; static void -on_show_all_windows_changed (MateConfClient *client, - guint conn_id, - MateConfEntry *entry, +on_show_all_windows_changed (GSettings *settings, + gchar *key, gpointer data) { WinPickerApp *app; @@ -86,8 +87,7 @@ on_show_all_windows_changed (MateConfClient *client, app = (WinPickerApp*)data; - show_windows = mate_panel_applet_mateconf_get_bool (MATE_PANEL_APPLET (app->applet), - SHOW_WIN_KEY, NULL); + show_windows = g_settings_get_boolean (settings, SHOW_WIN_KEY); g_object_set (app->tasks, "show_all_windows", show_windows, NULL); } @@ -122,8 +122,6 @@ cw_applet_fill (MatePanelApplet *applet, MatewnckScreen *screen; WinPickerApp *app; GtkWidget *eb, *tasks, *title; - GError *error = NULL; - gchar *key; gchar *ui_path; GtkActionGroup *action_group; @@ -140,21 +138,10 @@ cw_applet_fill (MatePanelApplet *applet, mainapp = app; screen = matewnck_screen_get_default (); - /* mateconf prefs */ - mate_panel_applet_add_preferences (applet, - "/schemas/apps/mate-window-picker-applet/prefs", - &error); - if (error) - { - g_warning ("%s", error->message); - g_error_free (error); - } - - key = mate_panel_applet_mateconf_get_full_key (applet, SHOW_WIN_KEY); - mateconf_client_notify_add (mateconf_client_get_default (), key, - on_show_all_windows_changed, app, - NULL, NULL); - g_free (key); + /* gsettings prefs */ + app->settings = mate_panel_applet_settings_new (applet, APPLET_SCHEMA); + g_signal_connect (app->settings, "changed::" SHOW_WIN_KEY, + G_CALLBACK (on_show_all_windows_changed), app); app->applet = GTK_WIDGET (applet); force_no_focus_padding (GTK_WIDGET (applet)); @@ -172,7 +159,7 @@ cw_applet_fill (MatePanelApplet *applet, gtk_widget_show_all (GTK_WIDGET (applet)); - on_show_all_windows_changed (NULL, 0, NULL, app); + on_show_all_windows_changed (app->settings, SHOW_WIN_KEY, app); /* Signals */ g_signal_connect (applet, "change-background", @@ -287,8 +274,7 @@ on_checkbox_toggled (GtkToggleButton *check, gpointer null) is_active = gtk_toggle_button_get_active (check); - mate_panel_applet_mateconf_set_bool (MATE_PANEL_APPLET (mainapp->applet), - SHOW_WIN_KEY, is_active, NULL); + g_settings_set_boolean (mainapp->settings, SHOW_WIN_KEY, is_active); } static void @@ -317,9 +303,7 @@ display_prefs_dialog (GtkAction *action, check = gtk_check_button_new_with_label (_("Show windows from all workspaces")); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), - mate_panel_applet_mateconf_get_bool ( - MATE_PANEL_APPLET (mainapp->applet), - SHOW_WIN_KEY, NULL)); + g_settings_get_boolean (mainapp->settings, SHOW_WIN_KEY)); g_signal_connect (check, "toggled", G_CALLBACK (on_checkbox_toggled), NULL); diff --git a/mate-window-picker-applet/mate-window-picker-applet.schemas.in b/mate-window-picker-applet/mate-window-picker-applet.schemas.in deleted file mode 100644 index ccceb1c..0000000 --- a/mate-window-picker-applet/mate-window-picker-applet.schemas.in +++ /dev/null @@ -1,13 +0,0 @@ -<mateconfschemafile> - <schemalist> - <schema> - <key>/schemas/apps/mate-window-picker-applet/prefs/show_all_windows</key> - <owner>mate-window-picker-applet</owner> - <type>bool</type> - <default>true</default> - <locale name="C"> - <short>Show windows from all workspaces.</short> - </locale> - </schema> - </schemalist> -</mateconfschemafile> diff --git a/mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in.in b/mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in.in new file mode 100644 index 0000000..88964f1 --- /dev/null +++ b/mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in.in @@ -0,0 +1,9 @@ +<schemalist gettext-domain="@GETTEXT_PACKAGE@"> + <schema id="org.mate.panel.applet.mate-window-picker-applet"> + <key name="show-all-windows" type="b"> + <default>true</default> + <_summary>Show windows from all workspaces.</_summary> + <_description>Show windows from all workspaces.</_description> + </key> + </schema> +</schemalist> diff --git a/mate-window-picker-applet/task-title.c b/mate-window-picker-applet/task-title.c index 4795559..35d8854 100644 --- a/mate-window-picker-applet/task-title.c +++ b/mate-window-picker-applet/task-title.c @@ -21,10 +21,6 @@ #include <libmatewnck/libmatewnck.h> #include <mate-panel-applet.h> -#include <mate-panel-applet-mateconf.h> - -#include <mateconf/mateconf.h> -#include <mateconf/mateconf-client.h> #include "task-list.h" @@ -35,7 +31,7 @@ G_DEFINE_TYPE (TaskTitle, task_title, GTK_TYPE_EVENT_BOX); TaskTitlePrivate)) #define LOGOUT "mate-session-save --kill --gui" -#define SHOW_HOME_TITLE_KEY "/apps/window-picker-applet/show_home_title" +#define SHOW_HOME_TITLE_KEY "show-home-title" struct _TaskTitlePrivate { @@ -406,7 +402,6 @@ static void task_title_init (TaskTitle *title) { TaskTitlePrivate *priv; - MateConfClient *client; GdkScreen *gdkscreen; GtkIconTheme *theme; GtkSettings *settings; @@ -419,11 +414,9 @@ task_title_init (TaskTitle *title) priv->screen = matewnck_screen_get_default (); priv->window = NULL; - client = mateconf_client_get_default (); - priv->show_home_title = mateconf_client_get_bool (client, - SHOW_HOME_TITLE_KEY, - NULL); - g_object_unref (client); + /* FIXME we can add an option for this in future */ + /* now it's disabled with gsettings migration */ + priv->show_home_title = FALSE; gtk_widget_add_events (GTK_WIDGET (title), GDK_ALL_EVENTS_MASK); |