diff options
Diffstat (limited to 'applets')
-rw-r--r-- | applets/notification_area/Makefile.am | 2 | ||||
-rw-r--r-- | applets/notification_area/main.c | 1 | ||||
-rw-r--r-- | applets/notification_area/na-tray.c | 1 | ||||
-rw-r--r-- | applets/wncklet/Makefile.am | 29 | ||||
-rw-r--r-- | applets/wncklet/window-list.c | 196 | ||||
-rw-r--r-- | applets/wncklet/window-list.schemas.in | 77 | ||||
-rw-r--r-- | applets/wncklet/workspace-switcher.c | 160 | ||||
-rw-r--r-- | applets/wncklet/workspace-switcher.schemas.in | 52 |
8 files changed, 104 insertions, 414 deletions
diff --git a/applets/notification_area/Makefile.am b/applets/notification_area/Makefile.am index 8609eff9..458e1875 100644 --- a/applets/notification_area/Makefile.am +++ b/applets/notification_area/Makefile.am @@ -29,7 +29,7 @@ libtray_la_SOURCES = \ NOTIFICATION_AREA_SOURCES = main.c NOTIFICATION_AREA_LDADD = \ - ../../libmate-panel-applet/libmate-panel-applet-3.la \ + ../../libmate-panel-applet/libmate-panel-applet-4.la \ libtray.la \ $(X_LIBS) \ $(NOTIFICATION_AREA_LIBS) \ diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c index bd43f51e..c6414efc 100644 --- a/applets/notification_area/main.c +++ b/applets/notification_area/main.c @@ -25,7 +25,6 @@ #include <string.h> #include <mate-panel-applet.h> -#include <mate-panel-applet-mateconf.h> #include <glib/gi18n.h> #include <gtk/gtk.h> diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c index b866e880..e62c14a0 100644 --- a/applets/notification_area/na-tray.c +++ b/applets/notification_area/na-tray.c @@ -23,7 +23,6 @@ #include <string.h> #include <mate-panel-applet.h> -#include <mate-panel-applet-mateconf.h> #include <gtk/gtk.h> diff --git a/applets/wncklet/Makefile.am b/applets/wncklet/Makefile.am index b5ccdfbc..55a2dddc 100644 --- a/applets/wncklet/Makefile.am +++ b/applets/wncklet/Makefile.am @@ -26,7 +26,7 @@ WNCKLET_SOURCES = \ showdesktop.h WNCKLET_LDADD = \ - ../../libmate-panel-applet/libmate-panel-applet-3.la \ + ../../libmate-panel-applet/libmate-panel-applet-4.la \ $(WNCKLET_LIBS) \ $(LIBMATE_PANEL_APPLET_LIBS) @@ -84,32 +84,19 @@ xmlui_DATA = \ showdesktop-menu.xml \ window-list-menu.xml -schemasdir = $(MATECONF_SCHEMA_FILE_DIR) -schemas_in_files = workspace-switcher.schemas.in window-list.schemas.in -schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) - -@INTLTOOL_SCHEMAS_RULE@ - -if MATECONF_SCHEMAS_INSTALL -install-data-local: - if test -z "$(DESTDIR)" ; then \ - for p in $(schemas_DATA) ; do \ - MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $(top_builddir)/applets/wncklet/$$p ; \ - done \ - fi -uninstall-local: - for p in $(schema_DATA) ; do \ - MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-uninstall-rule $(top_builddir)/applets/wncklet/$$p ; \ - done -endif +gsettings_SCHEMAS = \ + org.mate.panel.applet.window-list.gschema.xml \ + org.mate.panel.applet.workspace-switcher.gschema.xml +@INTLTOOL_XML_NOMERGE_RULE@ +@GSETTINGS_RULES@ EXTRA_DIST = \ org.mate.panel.Wncklet.mate-panel-applet.in.in \ $(service_in_files) \ $(xmlui_DATA) \ - $(schemas_in_files) \ + $(gsettings_SCHEMAS) \ $(ui_DATA) -CLEANFILES = $(schemas_DATA) $(applet_DATA) $(applet_DATA).in $(service_DATA) +CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) -include $(top_srcdir)/git.mk diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c index feebff0d..0b393bed 100644 --- a/applets/wncklet/window-list.c +++ b/applets/wncklet/window-list.c @@ -15,17 +15,18 @@ #include <string.h> #include <mate-panel-applet.h> -#include <mate-panel-applet-mateconf.h> +#include <mate-panel-applet-gsettings.h> #include <glib/gi18n.h> #include <gtk/gtk.h> #include <libmatewnck/libmatewnck.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include "wncklet.h" #include "window-list.h" #define WINDOW_LIST_ICON "mate-panel-window-list" +#define WINDOW_LIST_SCHEMA "org.mate.panel.applet.window-list" typedef struct { GtkWidget* applet; @@ -51,8 +52,7 @@ typedef struct { GtkWidget* move_minimized_radio; GtkWidget* change_workspace_radio; - /* mateconf listeners id */ - guint listeners [3]; + GSettings* settings; } TasklistData; static void callSystemMonitor(GtkAction* action, TasklistData* tasklist); @@ -144,17 +144,7 @@ static void applet_change_pixel_size(MatePanelApplet* applet, gint size, Tasklis static void destroy_tasklist(GtkWidget* widget, TasklistData* tasklist) { - MateConfClient* client = mateconf_client_get_default(); - - mateconf_client_notify_remove(client, tasklist->listeners[0]); - mateconf_client_notify_remove(client, tasklist->listeners[1]); - mateconf_client_notify_remove(client, tasklist->listeners[2]); - - g_object_unref(G_OBJECT(client)); - - tasklist->listeners[0] = 0; - tasklist->listeners[1] = 0; - tasklist->listeners[2] = 0; + g_object_unref(tasklist->settings); if (tasklist->properties_dialog) gtk_widget_destroy(tasklist->properties_dialog); @@ -228,14 +218,11 @@ static void tasklist_properties_update_content_radio(TasklistData* tasklist) gtk_widget_set_sensitive(tasklist->change_workspace_radio, tasklist->include_all_workspaces); } -static void display_all_workspaces_changed(MateConfClient* client, guint cnxn_id, MateConfEntry* entry, TasklistData* tasklist) +static void display_all_workspaces_changed(GSettings* settings, gchar* key, TasklistData* tasklist) { gboolean value; - if (!entry->value || entry->value->type != MATECONF_VALUE_BOOL) - return; - - value = mateconf_value_get_bool(entry->value); + value = g_settings_get_boolean(settings, key); tasklist->include_all_workspaces = (value != 0); tasklist_update(tasklist); @@ -243,40 +230,6 @@ static void display_all_workspaces_changed(MateConfClient* client, guint cnxn_id tasklist_properties_update_content_radio(tasklist); } -static MatewnckTasklistGroupingType get_grouping_type(MateConfValue* value) -{ - MatewnckTasklistGroupingType type = -1; - const char* str; - - g_assert(value != NULL); - - /* Backwards compat for old type: */ - if (value->type == MATECONF_VALUE_BOOL) - { - type = (mateconf_value_get_bool(value)) ? MATEWNCK_TASKLIST_AUTO_GROUP : MATEWNCK_TASKLIST_NEVER_GROUP; - - } - else if (value->type == MATECONF_VALUE_STRING) - { - str = mateconf_value_get_string(value); - - if (g_ascii_strcasecmp(str, "never") == 0) - { - type = MATEWNCK_TASKLIST_NEVER_GROUP; - } - else if (g_ascii_strcasecmp(str, "auto") == 0) - { - type = MATEWNCK_TASKLIST_AUTO_GROUP; - } - else if (g_ascii_strcasecmp(str, "always") == 0) - { - type = MATEWNCK_TASKLIST_ALWAYS_GROUP; - } - } - - return type; -} - static GtkWidget* get_grouping_button(TasklistData* tasklist, MatewnckTasklistGroupingType type) { switch (type) @@ -294,21 +247,12 @@ static GtkWidget* get_grouping_button(TasklistData* tasklist, MatewnckTasklistGr } } -static void group_windows_changed(MateConfClient* client, guint cnxn_id, MateConfEntry* entry, TasklistData* tasklist) +static void group_windows_changed(GSettings* settings, gchar* key, TasklistData* tasklist) { MatewnckTasklistGroupingType type; GtkWidget* button; - if (!entry->value || (entry->value->type != MATECONF_VALUE_BOOL && entry->value->type != MATECONF_VALUE_STRING)) - return; - - type = get_grouping_type(entry->value); - - if (type == -1) - { - g_warning("tasklist: Unknown value for MateConf key 'group_windows'"); - return; - } + type = g_settings_get_enum (settings, key); tasklist->grouping = type; tasklist_update(tasklist); @@ -342,14 +286,11 @@ static void tasklist_update_unminimization_radio(TasklistData* tasklist) } -static void move_unminimized_windows_changed(MateConfClient* client, guint cnxn_id, MateConfEntry* entry, TasklistData* tasklist) +static void move_unminimized_windows_changed(GSettings* settings, gchar* key, TasklistData* tasklist) { gboolean value; - if (!entry->value || entry->value->type != MATECONF_VALUE_BOOL) - return; - - value = mateconf_value_get_bool(entry->value); + value = g_settings_get_boolean(settings, key); tasklist->move_unminimized_windows = (value != 0); tasklist_update(tasklist); @@ -357,26 +298,22 @@ static void move_unminimized_windows_changed(MateConfClient* client, guint cnxn_ tasklist_update_unminimization_radio(tasklist); } -static void setup_mateconf(TasklistData* tasklist) +static void setup_gsettings(TasklistData* tasklist) { - MateConfClient* client; - char* key; - - client = mateconf_client_get_default(); - - key = mate_panel_applet_mateconf_get_full_key(MATE_PANEL_APPLET(tasklist->applet), "display_all_workspaces"); - tasklist->listeners[0] = mateconf_client_notify_add(client, key, (MateConfClientNotifyFunc) display_all_workspaces_changed, tasklist, NULL, NULL); - g_free(key); - - key = mate_panel_applet_mateconf_get_full_key(MATE_PANEL_APPLET(tasklist->applet), "group_windows"); - tasklist->listeners[1] = mateconf_client_notify_add(client, key, (MateConfClientNotifyFunc) group_windows_changed, tasklist, NULL, NULL); - g_free(key); - - key = mate_panel_applet_mateconf_get_full_key(MATE_PANEL_APPLET(tasklist->applet), "move_unminimized_windows"); - tasklist->listeners[2] = mateconf_client_notify_add(client, key, (MateConfClientNotifyFunc) move_unminimized_windows_changed, tasklist, NULL, NULL); - g_free(key); - - g_object_unref(G_OBJECT(client)); + tasklist->settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (tasklist->applet), WINDOW_LIST_SCHEMA); + + g_signal_connect (tasklist->settings, + "changed::display-all-workspaces", + G_CALLBACK (display_all_workspaces_changed), + tasklist); + g_signal_connect (tasklist->settings, + "changed::group-windows", + G_CALLBACK (group_windows_changed), + tasklist); + g_signal_connect (tasklist->settings, + "changed::move-unminimized-windows", + G_CALLBACK (move_unminimized_windows_changed), + tasklist); } static void applet_size_request(GtkWidget* widget, GtkRequisition* requisition, TasklistData* tasklist) @@ -445,8 +382,6 @@ gboolean window_list_applet_fill(MatePanelApplet* applet) TasklistData* tasklist; GtkActionGroup* action_group; gchar* ui_path; - GError* error; - MateConfValue* value; tasklist = g_new0(TasklistData, 1); @@ -454,46 +389,13 @@ gboolean window_list_applet_fill(MatePanelApplet* applet) mate_panel_applet_set_flags(MATE_PANEL_APPLET(tasklist->applet), MATE_PANEL_APPLET_EXPAND_MAJOR | MATE_PANEL_APPLET_EXPAND_MINOR | MATE_PANEL_APPLET_HAS_HANDLE); - mate_panel_applet_add_preferences(applet, "/schemas/apps/window_list_applet/prefs", NULL); - - setup_mateconf(tasklist); - - error = NULL; - - tasklist->include_all_workspaces = mate_panel_applet_mateconf_get_bool(applet, "display_all_workspaces", &error); - - if (error) - { - g_error_free(error); - tasklist->include_all_workspaces = FALSE; /* Default value */ - } - - error = NULL; - tasklist->grouping = -1; + setup_gsettings(tasklist); - value = mate_panel_applet_mateconf_get_value(applet, "group_windows", &error); + tasklist->include_all_workspaces = g_settings_get_boolean (tasklist->settings, "display-all-workspaces"); - if (error) - { - g_error_free(error); - } - else if (value) - { - tasklist->grouping = get_grouping_type(value); - mateconf_value_free(value); - } + tasklist->grouping = g_settings_get_enum (tasklist->settings, "group-windows"); - if (tasklist->grouping < 0) - tasklist->grouping = MATEWNCK_TASKLIST_AUTO_GROUP; /* Default value */ - - error = NULL; - tasklist->move_unminimized_windows = mate_panel_applet_mateconf_get_bool(applet, "move_unminimized_windows", &error); - - if (error) - { - g_error_free(error); - tasklist->move_unminimized_windows = TRUE; /* Default value */ - } + tasklist->move_unminimized_windows = g_settings_get_boolean (tasklist->settings, "move-unminimized-windows"); tasklist->size = mate_panel_applet_get_size(applet); @@ -647,8 +549,8 @@ static void group_windows_toggled(GtkToggleButton* button, TasklistData* tasklis { if (gtk_toggle_button_get_active(button)) { - char* str = g_object_get_data(G_OBJECT(button), "group_value"); - mate_panel_applet_mateconf_set_string(MATE_PANEL_APPLET(tasklist->applet), "group_windows", str, NULL); + gint value = g_object_get_data(G_OBJECT(button), "group_value"); + g_settings_set_enum (tasklist->settings, "group-windows", value); } } @@ -660,38 +562,32 @@ static void group_windows_toggled(GtkToggleButton* button, TasklistData* tasklis printf("str: %s\n", str); // Add later! - //mate_panel_applet_mateconf_set_string(MATE_PANEL_APPLET(tasklist->applet), "group_button", str, NULL); + //mate_panel_applet_mate_conf_set_string(MATE_PANEL_APPLET(tasklist->applet), "group_button", str, NULL); } }*/ static void move_minimized_toggled(GtkToggleButton* button, TasklistData* tasklist) { - mate_panel_applet_mateconf_set_bool(MATE_PANEL_APPLET(tasklist->applet), "move_unminimized_windows", gtk_toggle_button_get_active(button), NULL); + g_settings_set_boolean(tasklist->settings, "move-unminimized-windows", gtk_toggle_button_get_active(button)); } static void display_all_workspaces_toggled(GtkToggleButton* button, TasklistData* tasklist) { - mate_panel_applet_mateconf_set_bool(MATE_PANEL_APPLET(tasklist->applet), "display_all_workspaces", gtk_toggle_button_get_active(button), NULL); + g_settings_set_boolean(tasklist->settings, "display-all-workspaces", gtk_toggle_button_get_active(button)); } #define WID(s) GTK_WIDGET(gtk_builder_get_object(builder, s)) -static void setup_sensitivity(TasklistData* tasklist, MateConfClient* client, GtkBuilder* builder, const char* wid1, const char* wid2, const char* wid3, const char* key) +static void setup_sensitivity(TasklistData* tasklist, GtkBuilder* builder, const char* wid1, const char* wid2, const char* wid3, const char* key) { MatePanelApplet* applet = MATE_PANEL_APPLET(tasklist->applet); - char* fullkey; GtkWidget* w; - fullkey = mate_panel_applet_mateconf_get_full_key(applet, key); - - if (mateconf_client_key_is_writable(client, fullkey, NULL)) + if (g_settings_is_writable(tasklist->settings, key)) { - g_free(fullkey); return; } - g_free(fullkey); - w = WID(wid1); g_assert(w != NULL); gtk_widget_set_sensitive(w, FALSE); @@ -713,39 +609,35 @@ static void setup_sensitivity(TasklistData* tasklist, MateConfClient* client, Gt static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist) { - MateConfClient* client; GtkWidget* button; - client = mateconf_client_get_default(); - tasklist->show_current_radio = WID("show_current_radio"); tasklist->show_all_radio = WID("show_all_radio"); - setup_sensitivity(tasklist, client, builder, "show_current_radio", "show_all_radio", NULL, "display_all_workspaces" /* key */); + setup_sensitivity(tasklist, builder, "show_current_radio", "show_all_radio", NULL, "display-all-workspaces" /* key */); tasklist->never_group_radio = WID("never_group_radio"); tasklist->auto_group_radio = WID("auto_group_radio"); tasklist->always_group_radio = WID("always_group_radio"); - setup_sensitivity(tasklist, client, builder, "never_group_radio", "auto_group_radio", "always_group_radio", "group_windows" /* key */); + setup_sensitivity(tasklist, builder, "never_group_radio", "auto_group_radio", "always_group_radio", "group-windows" /* key */); tasklist->minimized_windows_label = WID("minimized_windows_label"); tasklist->move_minimized_radio = WID("move_minimized_radio"); tasklist->change_workspace_radio = WID("change_workspace_radio"); - /*tasklist->style_group_radio = WID("style_button_radio"); tasklist->icon_group_radio = WID("icon_only_radio"); tasklist->text_group_radio = WID("text_only_radio");*/ - setup_sensitivity(tasklist, client, builder, "move_minimized_radio", "change_workspace_radio", NULL, "move_unminimized_windows" /* key */); + setup_sensitivity(tasklist, builder, "move_minimized_radio", "change_workspace_radio", NULL, "move-unminimized-windows" /* key */); /* Window grouping: */ button = get_grouping_button(tasklist, tasklist->grouping); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); - g_object_set_data(G_OBJECT(tasklist->never_group_radio), "group_value", "never"); - g_object_set_data(G_OBJECT(tasklist->auto_group_radio), "group_value", "auto"); - g_object_set_data(G_OBJECT(tasklist->always_group_radio), "group_value", "always"); + g_object_set_data(G_OBJECT(tasklist->never_group_radio), "group_value", MATEWNCK_TASKLIST_NEVER_GROUP); + g_object_set_data(G_OBJECT(tasklist->auto_group_radio), "group_value", MATEWNCK_TASKLIST_AUTO_GROUP); + g_object_set_data(G_OBJECT(tasklist->always_group_radio), "group_value", MATEWNCK_TASKLIST_ALWAYS_GROUP); g_signal_connect(G_OBJECT(tasklist->never_group_radio), "toggled", (GCallback) group_windows_toggled, tasklist); g_signal_connect(G_OBJECT(tasklist->auto_group_radio), "toggled", (GCallback) group_windows_toggled, tasklist); @@ -772,8 +664,6 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist) g_signal_connect_swapped(WID("done_button"), "clicked", (GCallback) gtk_widget_hide, tasklist->properties_dialog); g_signal_connect(tasklist->properties_dialog, "response", G_CALLBACK(response_cb), tasklist); - - g_object_unref(G_OBJECT(client)); } static void display_properties_dialog(GtkAction* action, TasklistData* tasklist) diff --git a/applets/wncklet/window-list.schemas.in b/applets/wncklet/window-list.schemas.in deleted file mode 100644 index 99d79963..00000000 --- a/applets/wncklet/window-list.schemas.in +++ /dev/null @@ -1,77 +0,0 @@ -<mateconfschemafile> - <schemalist> - - <schema> - <key>/schemas/apps/window_list_applet/prefs/display_all_workspaces</key> - <owner>window-list-applet</owner> - <type>bool</type> - <default>false</default> - <locale name="C"> - <short>Show windows from all workspaces</short> - <long> - If true, the window list will show windows from all workspaces. - Otherwise it will only display windows from the current workspace. - </long> - </locale> - </schema> - - <schema> - <key>/schemas/apps/window_list_applet/prefs/group_windows</key> - <owner>window-list-applet</owner> - <type>string</type> - <default>never</default> - <locale name="C"> - <short>When to group windows</short> - <long> - Decides when to group windows from the same application on the - window list. Possible values are "never", "auto" and "always". - </long> - </locale> - </schema> - - <schema> - <key>/schemas/apps/window_list_applet/prefs/move_unminimized_windows</key> - <owner>window-list-applet</owner> - <type>bool</type> - <default>true</default> - <locale name="C"> - <short>Move windows to current workspace when unminimized</short> - <long> - If true, then when unminimizing a window, move it to the - current workspace. Otherwise, switch to the workspace of - the window. - </long> - </locale> - </schema> - - <schema> - <key>/schemas/apps/window_list_applet/prefs/minimum_size</key> - <owner>window-list-applet</owner> - <type>int</type> - <default>50</default> - <locale name="C"> - <short>Minimum window list size</short> - <long> - The use of this key was deprecated in GNOME 2.20. The schema is - retained for compatibility with older versions. - </long> - </locale> - </schema> - - <schema> - <key>/schemas/apps/window_list_applet/prefs/maximum_size</key> - <owner>window-list-applet</owner> - <type>int</type> - <default>4096</default> - <locale name="C"> - <short>Maximum window list size</short> - <long> - The use of this key was deprecated in GNOME 2.20. The schema is - retained for compatibility with older versions. - </long> - </locale> - </schema> - - </schemalist> - -</mateconfschemafile> diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c index 3fcd5085..4d24663f 100644 --- a/applets/wncklet/workspace-switcher.c +++ b/applets/wncklet/workspace-switcher.c @@ -15,14 +15,14 @@ #include <string.h> #include <mate-panel-applet.h> -#include <mate-panel-applet-mateconf.h> +#include <mate-panel-applet-gsettings.h> #include <stdlib.h> #include <glib/gi18n.h> #include <gtk/gtk.h> #include <libmatewnck/libmatewnck.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include "workspace-switcher.h" @@ -32,9 +32,13 @@ #define MAX_REASONABLE_ROWS 16 #define DEFAULT_ROWS 1 +#define WORKSPACE_SWITCHER_SCHEMA "org.mate.panel.applet.workspace-switcher" + #define NEVER_SENSITIVE "never_sensitive" -#define NUM_WORKSPACES "/apps/marco/general/num_workspaces" -#define WORKSPACE_NAME "/apps/marco/workspace_names/name_1" +#define MARCO_GENERAL_SCHEMA "org.mate.Marco.general" +#define NUM_WORKSPACES "num-workspaces" +#define MARCO_WORSKACES_SCHEMA "org.mate.Marco.workspace-names" +#define WORKSPACE_NAME "name-1" #define WORKSPACE_SWITCHER_ICON "mate-panel-workspace-switcher" @@ -71,8 +75,7 @@ typedef struct { MatewnckPagerDisplayMode display_mode; gboolean display_all; - /* mateconf listeners id */ - guint listeners[3]; + GSettings* settings; } PagerData; static void display_properties_dialog(GtkAction* action, PagerData* pager); @@ -289,17 +292,7 @@ static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, Pa static void destroy_pager(GtkWidget* widget, PagerData* pager) { - MateConfClient* client = mateconf_client_get_default(); - - mateconf_client_notify_remove(client, pager->listeners[0]); - mateconf_client_notify_remove(client, pager->listeners[1]); - mateconf_client_notify_remove(client, pager->listeners[2]); - - g_object_unref(G_OBJECT(client)); - - pager->listeners[0] = 0; - pager->listeners[1] = 0; - pager->listeners[2] = 0; + g_object_unref (pager->settings); if (pager->properties_dialog) gtk_widget_destroy(pager->properties_dialog); @@ -334,14 +327,11 @@ static const GtkActionEntry pager_menu_actions[] = { } }; -static void num_rows_changed(MateConfClient* client, guint cnxn_id, MateConfEntry* entry, PagerData* pager) +static void num_rows_changed(GSettings* settings, gchar* key, PagerData* pager) { int n_rows = DEFAULT_ROWS; - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_INT) - { - n_rows = mateconf_value_get_int(entry->value); - } + n_rows = g_settings_get_int (settings, key); n_rows = CLAMP(n_rows, 1, MAX_REASONABLE_ROWS); @@ -352,14 +342,11 @@ static void num_rows_changed(MateConfClient* client, guint cnxn_id, MateConfEntr gtk_spin_button_set_value(GTK_SPIN_BUTTON(pager->num_rows_spin), pager->n_rows); } -static void display_workspace_names_changed(MateConfClient* client, guint cnxn_id, MateConfEntry* entry, PagerData* pager) +static void display_workspace_names_changed(GSettings* settings, gchar* key, PagerData* pager) { gboolean value = FALSE; /* Default value */ - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_BOOL) - { - value = mateconf_value_get_bool(entry->value); - } + value = g_settings_get_boolean (settings, key); if (value) { @@ -379,14 +366,11 @@ static void display_workspace_names_changed(MateConfClient* client, guint cnxn_i } -static void all_workspaces_changed(MateConfClient* client, guint cnxn_id, MateConfEntry* entry, PagerData* pager) +static void all_workspaces_changed(GSettings* settings, gchar* key, PagerData* pager) { gboolean value = TRUE; /* Default value */ - if (entry->value != NULL && entry->value->type == MATECONF_VALUE_BOOL) - { - value = mateconf_value_get_bool(entry->value); - } + value = g_settings_get_boolean (settings, key); pager->display_all = value; pager_update(pager); @@ -410,30 +394,22 @@ static void all_workspaces_changed(MateConfClient* client, guint cnxn_id, MateCo } } -static void setup_mateconf(PagerData* pager) +static void setup_gsettings(PagerData* pager) { - MateConfClient* client; - char* key; - - client = mateconf_client_get_default(); - - key = mate_panel_applet_mateconf_get_full_key(MATE_PANEL_APPLET(pager->applet), "num_rows"); - pager->listeners[0] = mateconf_client_notify_add(client, key, (MateConfClientNotifyFunc) num_rows_changed, pager, NULL, NULL); - - g_free(key); - - - key = mate_panel_applet_mateconf_get_full_key(MATE_PANEL_APPLET(pager->applet), "display_workspace_names"); - pager->listeners[1] = mateconf_client_notify_add(client, key, (MateConfClientNotifyFunc) display_workspace_names_changed, pager, NULL, NULL); - - g_free(key); - - key = mate_panel_applet_mateconf_get_full_key(MATE_PANEL_APPLET(pager->applet), "display_all_workspaces"); - pager->listeners[2] = mateconf_client_notify_add(client, key, (MateConfClientNotifyFunc) all_workspaces_changed, pager, NULL, NULL); + pager->settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (pager->applet), WORKSPACE_SWITCHER_SCHEMA); - g_free(key); - - g_object_unref(G_OBJECT(client)); + g_signal_connect (pager->settings, + "changed::num-rows", + G_CALLBACK (num_rows_changed), + pager); + g_signal_connect (pager->settings, + "changed::display-workspace-names", + G_CALLBACK (display_workspace_names_changed), + pager); + g_signal_connect (pager->settings, + "changed::display-all-workspaces", + G_CALLBACK (all_workspaces_changed), + pager); } gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) @@ -441,40 +417,21 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) PagerData* pager; GtkActionGroup* action_group; gchar* ui_path; - GError* error; gboolean display_names; - mate_panel_applet_add_preferences(applet, "/schemas/apps/workspace_switcher_applet/prefs", NULL); - pager = g_new0(PagerData, 1); pager->applet = GTK_WIDGET(applet); mate_panel_applet_set_flags(MATE_PANEL_APPLET(pager->applet), MATE_PANEL_APPLET_EXPAND_MINOR); - setup_mateconf(pager); + setup_gsettings(pager); - error = NULL; - pager->n_rows = mate_panel_applet_mateconf_get_int(applet, "num_rows", &error); - - if (error) - { - g_printerr(_("Error loading num_rows value for Workspace Switcher: %s\n"), error->message); - g_error_free(error); - /* leave current value */ - } + pager->n_rows = g_settings_get_int(pager->settings, "num-rows"); pager->n_rows = CLAMP(pager->n_rows, 1, MAX_REASONABLE_ROWS); - error = NULL; - display_names = mate_panel_applet_mateconf_get_bool(applet, "display_workspace_names", &error); - - if (error) - { - g_printerr(_("Error loading display_workspace_names value for Workspace Switcher: %s\n"), error->message); - g_error_free(error); - /* leave current value */ - } + display_names = g_settings_get_boolean(pager->settings, "display-workspace-names"); if (display_names) { @@ -485,15 +442,7 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) pager->display_mode = MATEWNCK_PAGER_DISPLAY_CONTENT; } - error = NULL; - pager->display_all = mate_panel_applet_mateconf_get_bool(applet, "display_all_workspaces", &error); - - if (error) - { - g_printerr(_("Error loading display_all_workspaces value for Workspace Switcher: %s\n"), error->message); - g_error_free(error); - /* leave current value */ - } + pager->display_all = g_settings_get_boolean(pager->settings, "display-all-workspaces"); switch (mate_panel_applet_get_orient(applet)) { @@ -591,17 +540,17 @@ static void display_about_dialog(GtkAction* action, PagerData* pager) static void display_workspace_names_toggled(GtkToggleButton*button, PagerData* pager) { - mate_panel_applet_mateconf_set_bool(MATE_PANEL_APPLET(pager->applet), "display_workspace_names", gtk_toggle_button_get_active(button), NULL); + g_settings_set_boolean(pager->settings, "display-workspace-names", gtk_toggle_button_get_active(button)); } static void all_workspaces_toggled(GtkToggleButton* button, PagerData* pager) { - mate_panel_applet_mateconf_set_bool(MATE_PANEL_APPLET(pager->applet), "display_all_workspaces", gtk_toggle_button_get_active(button), NULL); + g_settings_set_boolean(pager->settings, "display-all-workspaces", gtk_toggle_button_get_active(button)); } static void num_rows_value_changed(GtkSpinButton* button, PagerData* pager) { - mate_panel_applet_mateconf_set_int(MATE_PANEL_APPLET(pager->applet), "num_rows", gtk_spin_button_get_value_as_int(button), NULL); + g_settings_set_int(pager->settings, "num-rows", gtk_spin_button_get_value_as_int(button)); } static void update_workspaces_model(PagerData* pager) @@ -752,28 +701,15 @@ static void close_dialog(GtkWidget* button, gpointer data) #define WID(s) GTK_WIDGET(gtk_builder_get_object(builder, s)) static void -setup_sensitivity(PagerData* pager, GtkBuilder* builder, const char* wid1, const char* wid2, const char* wid3, const char* key) +setup_sensitivity(PagerData* pager, GtkBuilder* builder, const char* wid1, const char* wid2, const char* wid3, GSettings* settings, const char* key) { - MatePanelApplet* applet = MATE_PANEL_APPLET(pager->applet); - MateConfClient* client = mateconf_client_get_default(); - char* fullkey; GtkWidget* w; - if (key[0] == '/') - fullkey = g_strdup(key); - else - fullkey = mate_panel_applet_mateconf_get_full_key(applet, key); - - if (mateconf_client_key_is_writable(client, fullkey, NULL)) + if (g_settings_is_writable(settings, key)) { - g_object_unref(G_OBJECT(client)); - g_free(fullkey); return; } - g_object_unref(G_OBJECT(client)); - g_free(fullkey); - w = WID(wid1); g_assert(w != NULL); g_object_set_data(G_OBJECT(w), NEVER_SENSITIVE, GINT_TO_POINTER(1)); @@ -802,27 +738,35 @@ static void setup_dialog(GtkBuilder* builder, PagerData* pager) GtkTreeViewColumn* column; GtkCellRenderer* cell; int nr_ws, i; + GSettings *marco_general_settings; + GSettings *marco_workspaces_settings; + + marco_general_settings = g_settings_new (MARCO_GENERAL_SCHEMA); + marco_workspaces_settings = g_settings_new (MARCO_WORSKACES_SCHEMA); pager->workspaces_frame = WID("workspaces_frame"); pager->workspace_names_label = WID("workspace_names_label"); pager->workspace_names_scroll = WID("workspace_names_scroll"); pager->display_workspaces_toggle = WID("workspace_name_toggle"); - setup_sensitivity(pager, builder, "workspace_name_toggle", NULL, NULL, "display_workspace_names" /* key */); + setup_sensitivity(pager, builder, "workspace_name_toggle", NULL, NULL, pager->settings, "display-workspace-names" /* key */); pager->all_workspaces_radio = WID("all_workspaces_radio"); pager->current_only_radio = WID("current_only_radio"); - setup_sensitivity(pager, builder, "all_workspaces_radio", "current_only_radio", "label_row_col", "display_all_workspaces" /* key */); + setup_sensitivity(pager, builder, "all_workspaces_radio", "current_only_radio", "label_row_col", pager->settings, "display-all-workspaces" /* key */); pager->num_rows_spin = WID("num_rows_spin"); pager->label_row_col = WID("label_row_col"); - setup_sensitivity(pager, builder, "num_rows_spin", NULL, NULL, "num_rows" /* key */); + setup_sensitivity(pager, builder, "num_rows_spin", NULL, NULL, pager->settings, "num-rows" /* key */); pager->num_workspaces_spin = WID("num_workspaces_spin"); - setup_sensitivity(pager, builder, "num_workspaces_spin", NULL, NULL, NUM_WORKSPACES /* key */); + setup_sensitivity(pager, builder, "num_workspaces_spin", NULL, NULL, marco_general_settings, NUM_WORKSPACES /* key */); pager->workspaces_tree = WID("workspaces_tree_view"); - setup_sensitivity(pager, builder, "workspaces_tree_view", NULL, NULL, WORKSPACE_NAME /* key */); + setup_sensitivity(pager, builder, "workspaces_tree_view", NULL, NULL, marco_workspaces_settings, WORKSPACE_NAME /* key */); + + g_object_unref (marco_general_settings); + g_object_unref (marco_workspaces_settings); /* Display workspace names: */ diff --git a/applets/wncklet/workspace-switcher.schemas.in b/applets/wncklet/workspace-switcher.schemas.in deleted file mode 100644 index 3096b9c3..00000000 --- a/applets/wncklet/workspace-switcher.schemas.in +++ /dev/null @@ -1,52 +0,0 @@ -<mateconfschemafile> - <schemalist> - - <schema> - <key>/schemas/apps/workspace_switcher_applet/prefs/display_workspace_names</key> - <owner>workspace-switcher-applet</owner> - <type>bool</type> - <default>false</default> - <locale name="C"> - <short>Display workspace names</short> - <long> - If true, the workspaces in the workspace switcher will display - the names of the workspaces. Otherwise they will display the - windows on the workspace. This setting only works when the window - manager is Marco. - </long> - </locale> - </schema> - - <schema> - <key>/schemas/apps/workspace_switcher_applet/prefs/display_all_workspaces</key> - <owner>workspace-switcher-applet</owner> - <type>bool</type> - <default>true</default> - <locale name="C"> - <short>Display all workspaces</short> - <long> - If true, the workspace switcher will show all workspaces. Otherwise - it will only show the current workspace. - </long> - </locale> - </schema> - - <schema> - <key>/schemas/apps/workspace_switcher_applet/prefs/num_rows</key> - <owner>workspace-switcher-applet</owner> - <type>int</type> - <default>1</default> - <locale name="C"> - <short>Rows in workspace switcher</short> - <long> - This key specifies how many rows (for horizontal layout) - or columns (for vertical layout) the workspace switcher shows the - workspaces in. This key is only relevant if the - display_all_workspaces key is true. - </long> - </locale> - </schema> - - </schemalist> - -</mateconfschemafile> |