diff options
author | Stefano Karapetsas <[email protected]> | 2012-12-07 06:06:41 -0800 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-12-07 06:06:41 -0800 |
commit | 12dcf19aa5f51901053c273cd7f5c17ce85e909d (patch) | |
tree | 5b71387df7bf817dd5d0dff60ecc09d8291dba0d | |
parent | a279b02b4d563d2300ccb588e5969c7dfac8108e (diff) | |
parent | 6e61d207a2088479f5bb12ce4edb1d2886c40b53 (diff) | |
download | mate-settings-daemon-12dcf19aa5f51901053c273cd7f5c17ce85e909d.tar.bz2 mate-settings-daemon-12dcf19aa5f51901053c273cd7f5c17ce85e909d.tar.xz |
Merge pull request #29 from jasmineaura/develop
Fix #23, and some cleanups
52 files changed, 344 insertions, 1992 deletions
diff --git a/configure.ac b/configure.ac index e68ea4f..2743ab6 100644 --- a/configure.ac +++ b/configure.ac @@ -238,7 +238,7 @@ AC_ARG_ENABLE(pulse, [WANT_PULSE=no]) dnl Default value if test x$WANT_PULSE = xyes ; then - PA_REQUIRED_VERSION=0.9.15 + PA_REQUIRED_VERSION=0.9.16 PKG_CHECK_MODULES(PULSE, glib-2.0 libpulse >= $PA_REQUIRED_VERSION libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra-gtk, [have_pulse=true AC_DEFINE(HAVE_PULSE, 1, [Define if PULSE sound server should be used])], @@ -471,7 +471,6 @@ plugins/clipboard/Makefile plugins/common/Makefile plugins/datetime/Makefile plugins/dummy/Makefile -plugins/font/Makefile plugins/housekeeping/Makefile plugins/keyboard/Makefile plugins/media-keys/Makefile diff --git a/data/Makefile.am b/data/Makefile.am index 3df1302..975daf9 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -10,7 +10,6 @@ gsettings_SCHEMAS = \ org.mate.SettingsDaemon.plugins.background.gschema.xml \ org.mate.SettingsDaemon.plugins.clipboard.gschema.xml \ org.mate.SettingsDaemon.plugins.datetime.gschema.xml \ - org.mate.SettingsDaemon.plugins.font.gschema.xml \ org.mate.SettingsDaemon.plugins.housekeeping.gschema.xml \ org.mate.SettingsDaemon.plugins.keyboard.gschema.xml \ org.mate.SettingsDaemon.plugins.media-keys.gschema.xml \ diff --git a/data/org.mate.SettingsDaemon.plugins.font.gschema.xml.in b/data/org.mate.SettingsDaemon.plugins.font.gschema.xml.in deleted file mode 100644 index 776af6d..0000000 --- a/data/org.mate.SettingsDaemon.plugins.font.gschema.xml.in +++ /dev/null @@ -1,14 +0,0 @@ -<schemalist> - <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.SettingsDaemon.plugins.font" path="/org/mate/settings-daemon/plugins/font/"> - <key name="active" type="b"> - <default>true</default> - <_summary>Activation of this plugin</_summary> - <_description>Whether this plugin would be activated by mate-settings-daemon or not</_description> - </key> - <key name="priority" type="i"> - <default>4</default> - <_summary>Priority to use for this plugin</_summary> - <_description>Priority to use for this plugin in mate-settings-daemon startup queue</_description> - </key> - </schema> -</schemalist> diff --git a/mate-settings-daemon/main.c b/mate-settings-daemon/main.c index fadf69a..b17e1a3 100644 --- a/mate-settings-daemon/main.c +++ b/mate-settings-daemon/main.c @@ -493,7 +493,7 @@ main (int argc, char *argv[]) daemon_terminate_parent (); if (do_timed_exit) { - g_timeout_add (1000 * 30, (GSourceFunc) timed_exit_cb, NULL); + g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, NULL); } gtk_main (); diff --git a/mate-settings-daemon/mate-settings-manager.c b/mate-settings-daemon/mate-settings-manager.c index d0e38b2..a9c99ed 100644 --- a/mate-settings-daemon/mate-settings-manager.c +++ b/mate-settings-daemon/mate-settings-manager.c @@ -145,6 +145,23 @@ on_plugin_deactivated (MateSettingsPluginInfo *info, g_signal_emit (manager, signals [PLUGIN_DEACTIVATED], 0, name); } +static gboolean +is_item_in_schema (const char * const *items, + const char *item) +{ + while (*items) { + if (g_strcmp0 (*items++, item) == 0) + return TRUE; + } + return FALSE; +} + +static gboolean +is_schema (const char *schema) +{ + return is_item_in_schema (g_settings_list_schemas (), schema); +} + static void _load_file (MateSettingsManager *manager, const char *filename) @@ -171,16 +188,25 @@ _load_file (MateSettingsManager *manager, manager->priv->plugins = g_slist_prepend (manager->priv->plugins, g_object_ref (info)); - g_signal_connect (info, "activated", - G_CALLBACK (on_plugin_activated), manager); - g_signal_connect (info, "deactivated", - G_CALLBACK (on_plugin_deactivated), manager); - schema = g_strdup_printf ("%s.plugins.%s", DEFAULT_SETTINGS_PREFIX, mate_settings_plugin_info_get_location (info)); - mate_settings_plugin_info_set_schema (info, schema); + /* Ignore unknown schemas or else we'll assert */ + if (is_schema (schema)) { + manager->priv->plugins = g_slist_prepend (manager->priv->plugins, + g_object_ref (info)); + + g_signal_connect (info, "activated", + G_CALLBACK (on_plugin_activated), manager); + g_signal_connect (info, "deactivated", + G_CALLBACK (on_plugin_deactivated), manager); + + /* Also sets priority for plugins */ + mate_settings_plugin_info_set_schema (info, schema); + } else { + g_warning ("Ignoring unknown module '%s'", schema); + } g_free (schema); diff --git a/mate-settings-daemon/mate-settings-plugin-info.c b/mate-settings-daemon/mate-settings-plugin-info.c index 9936fb7..17bc0d6 100644 --- a/mate-settings-daemon/mate-settings-plugin-info.c +++ b/mate-settings-daemon/mate-settings-plugin-info.c @@ -117,7 +117,9 @@ mate_settings_plugin_info_finalize (GObject *object) g_free (info->priv->copyright); g_strfreev (info->priv->authors); - g_object_unref (info->priv->settings); + if (info->priv->settings != NULL) { + g_object_unref (info->priv->settings); + } G_OBJECT_CLASS (mate_settings_plugin_info_parent_class)->finalize (object); } @@ -288,8 +290,8 @@ mate_settings_plugin_info_fill_from_file (MateSettingsPluginInfo *info, } static void -plugin_enabled_cb (GSettings *settings, - gchar *key, +plugin_enabled_cb (GSettings *settings, + gchar *key, MateSettingsPluginInfo *info) { if (g_settings_get_boolean (info->priv->settings, key)) { @@ -596,11 +598,17 @@ void mate_settings_plugin_info_set_schema (MateSettingsPluginInfo *info, gchar *schema) { - g_return_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info)); + int priority; + + g_return_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info)); + + info->priv->settings = g_settings_new (schema); + info->priv->enabled = g_settings_get_boolean (info->priv->settings, "active"); + + priority = g_settings_get_int (info->priv->settings, "priority"); + if (priority > 0) + info->priv->priority = priority; - info->priv->settings = g_settings_new (schema); - info->priv->priority = g_settings_get_int(info->priv->settings, "priority"); - info->priv->enabled = g_settings_get_boolean(info->priv->settings, "active"); - - g_signal_connect (info->priv->settings, "changed::active", G_CALLBACK (plugin_enabled_cb), info); + g_signal_connect (G_OBJECT (info->priv->settings), "changed::active", + G_CALLBACK (plugin_enabled_cb), info); } diff --git a/mate-settings-daemon/mate-settings-plugin.h b/mate-settings-daemon/mate-settings-plugin.h index 0f90567..534034f 100644 --- a/mate-settings-daemon/mate-settings-plugin.h +++ b/mate-settings-daemon/mate-settings-plugin.h @@ -59,123 +59,19 @@ void mate_settings_plugin_deactivate (MateSettingsPlugin *pl * * use: MATE_SETTINGS_PLUGIN_REGISTER (PluginName, plugin_name) */ -#define MATE_SETTINGS_PLUGIN_REGISTER(PluginName, plugin_name) \ - \ -static GType plugin_name##_type = 0; \ -static GTypeModule *plugin_module_type = 0; \ - \ -GType \ -plugin_name##_get_type (void) \ -{ \ - return plugin_name##_type; \ -} \ - \ -static void plugin_name##_init (PluginName *self); \ -static void plugin_name##_class_init (PluginName##Class *klass); \ -static gpointer plugin_name##_parent_class = NULL; \ -static void plugin_name##_class_intern_init (gpointer klass) \ -{ \ - plugin_name##_parent_class = g_type_class_peek_parent (klass); \ - plugin_name##_class_init ((PluginName##Class *) klass); \ -} \ - \ -G_MODULE_EXPORT GType \ -register_mate_settings_plugin (GTypeModule *module) \ -{ \ - static const GTypeInfo our_info = \ - { \ - sizeof (PluginName##Class), \ - NULL, /* base_init */ \ - NULL, /* base_finalize */ \ - (GClassInitFunc) plugin_name##_class_intern_init, \ - NULL, \ - NULL, /* class_data */ \ - sizeof (PluginName), \ - 0, /* n_preallocs */ \ - (GInstanceInitFunc) plugin_name##_init \ - }; \ - \ - g_debug ("Registering " #PluginName); \ - \ - /* Initialise the i18n stuff */ \ - bindtextdomain (GETTEXT_PACKAGE, MATE_SETTINGS_LOCALEDIR); \ - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \ - \ - plugin_module_type = module; \ - plugin_name##_type = g_type_module_register_type (module, \ - MATE_TYPE_SETTINGS_PLUGIN, \ - #PluginName, \ - &our_info, \ - 0); \ - \ - return plugin_name##_type; \ +#define MATE_SETTINGS_PLUGIN_REGISTER(PluginName, plugin_name) \ + G_DEFINE_DYNAMIC_TYPE (PluginName, \ + plugin_name, \ + MATE_TYPE_SETTINGS_PLUGIN) \ + \ +G_MODULE_EXPORT GType \ +register_mate_settings_plugin (GTypeModule *type_module) \ +{ \ + plugin_name##_register_type (type_module); \ + \ + return plugin_name##_get_type(); \ } -/* - * Utility macro used to register gobject types in plugins with additional code - * - * use: MATE_SETTINGS_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE) - */ -#define MATE_SETTINGS_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE) \ -static void object_name##_init (ObjectName *self); \ -static void object_name##_class_init (ObjectName##Class *klass); \ -static gpointer object_name##_parent_class = ((void *)0); \ -static GType ojbect_name##_type_id = 0; \ - \ -static void object_name##_class_intern_init (gpointer klass) \ -{ \ - object_name##_parent_class = g_type_class_peek_parent (klass); \ - object_name##_class_init ((ObjectName##Class *) klass); \ -} \ - \ - \ -GType \ -object_name##_get_type (void) \ -{ \ - g_assert (object_name##_type_id != 0); \ - \ - return object_name##_type_id; \ -} \ - \ -GType \ -object_name##_register_type (GTypeModule *module) \ -{ \ - if ((object_name##_type_id == 0)) { \ - const GTypeInfo g_define_type_info = { \ - sizeof (ObjectName##Class), \ - (GBaseInitFunc) ((void *)0), \ - (GBaseFinalizeFunc) ((void *)0), \ - (GClassInitFunc) object_name##_class_intern_init, \ - (GClassFinalizeFunc) ((void *)0), \ - ((void *)0), \ - sizeof (ObjectName), \ - 0, \ - (GInstanceInitFunc) object_name##_init, \ - ((void *)0) \ - }; \ - object_name##_type_id = \ - g_type_module_register_type (module, \ - PARENT_TYPE, \ - #ObjectName, \ - &g_define_type_info, \ - (GTypeFlags) 0); \ - } \ - \ - g_debug ("Registering " #ObjectName); \ - \ - CODE \ - \ - return type_name##_type_id; \ -} - -/* - * Utility macro used to register gobject types in plugins - * - * use: MATE_SETTINGS_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE) - */ -#define MATE_SETTINGS_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE) \ - MATE_SETTINGS_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, ;) - #ifdef __cplusplus } #endif diff --git a/plugins/Makefile.am b/plugins/Makefile.am index f1f227c..4741ba6 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -6,7 +6,6 @@ enabled_plugins = \ clipboard \ datetime \ dummy \ - font \ housekeeping \ keyboard \ media-keys \ diff --git a/plugins/a11y-keyboard/msd-a11y-keyboard-plugin.c b/plugins/a11y-keyboard/msd-a11y-keyboard-plugin.c index d905336..57ac653 100644 --- a/plugins/a11y-keyboard/msd-a11y-keyboard-plugin.c +++ b/plugins/a11y-keyboard/msd-a11y-keyboard-plugin.c @@ -102,3 +102,8 @@ msd_a11y_keyboard_plugin_class_init (MsdA11yKeyboardPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdA11yKeyboardPluginPrivate)); } + +static void +msd_a11y_keyboard_plugin_class_finalize (MsdA11yKeyboardPluginClass *klass) +{ +} diff --git a/plugins/background/msd-background-plugin.c b/plugins/background/msd-background-plugin.c index f5cb0d1..ee6b49c 100644 --- a/plugins/background/msd-background-plugin.c +++ b/plugins/background/msd-background-plugin.c @@ -27,85 +27,88 @@ #include "msd-background-plugin.h" #include "msd-background-manager.h" -//class MsdBackgroundPlugin -//{ - struct MsdBackgroundPluginPrivate { - MsdBackgroundManager* manager; - }; +struct MsdBackgroundPluginPrivate { + MsdBackgroundManager* manager; +}; - #define MSD_BACKGROUND_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE((object), MSD_TYPE_BACKGROUND_PLUGIN, MsdBackgroundPluginPrivate)) +#define MSD_BACKGROUND_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE((object), MSD_TYPE_BACKGROUND_PLUGIN, MsdBackgroundPluginPrivate)) - MATE_SETTINGS_PLUGIN_REGISTER(MsdBackgroundPlugin, msd_background_plugin) +MATE_SETTINGS_PLUGIN_REGISTER(MsdBackgroundPlugin, msd_background_plugin) - static void - msd_background_plugin_init (MsdBackgroundPlugin* plugin) - { - plugin->priv = MSD_BACKGROUND_PLUGIN_GET_PRIVATE(plugin); - - g_debug("MsdBackgroundPlugin initializing"); +static void +msd_background_plugin_init (MsdBackgroundPlugin* plugin) +{ + plugin->priv = MSD_BACKGROUND_PLUGIN_GET_PRIVATE(plugin); - plugin->priv->manager = msd_background_manager_new(); - } + g_debug("MsdBackgroundPlugin initializing"); - static void - msd_background_plugin_finalize (GObject* object) - { - MsdBackgroundPlugin* plugin; + plugin->priv->manager = msd_background_manager_new(); +} - g_return_if_fail(object != NULL); - g_return_if_fail(MSD_IS_BACKGROUND_PLUGIN(object)); +static void +msd_background_plugin_finalize (GObject* object) +{ + MsdBackgroundPlugin* plugin; - g_debug("MsdBackgroundPlugin finalizing"); + g_return_if_fail(object != NULL); + g_return_if_fail(MSD_IS_BACKGROUND_PLUGIN(object)); - plugin = MSD_BACKGROUND_PLUGIN(object); + g_debug("MsdBackgroundPlugin finalizing"); - g_return_if_fail(plugin->priv != NULL); + plugin = MSD_BACKGROUND_PLUGIN(object); - if (plugin->priv->manager != NULL) - { - g_object_unref (plugin->priv->manager); - } + g_return_if_fail(plugin->priv != NULL); - G_OBJECT_CLASS(msd_background_plugin_parent_class)->finalize(object); + if (plugin->priv->manager != NULL) + { + g_object_unref (plugin->priv->manager); } - static void - impl_activate (MateSettingsPlugin* plugin) - { - gboolean res; - GError* error; + G_OBJECT_CLASS(msd_background_plugin_parent_class)->finalize(object); +} - g_debug("Activating background plugin"); +static void +impl_activate (MateSettingsPlugin* plugin) +{ + gboolean res; + GError* error; - error = NULL; - res = msd_background_manager_start(MSD_BACKGROUND_PLUGIN(plugin)->priv->manager, &error); + g_debug("Activating background plugin"); - if (!res) - { - g_warning("Unable to start background manager: %s", error->message); - g_error_free(error); - } - } + error = NULL; + res = msd_background_manager_start(MSD_BACKGROUND_PLUGIN(plugin)->priv->manager, &error); - static void - impl_deactivate (MateSettingsPlugin* plugin) + if (!res) { - g_debug("Deactivating background plugin"); - - msd_background_manager_stop(MSD_BACKGROUND_PLUGIN(plugin)->priv->manager); + g_warning("Unable to start background manager: %s", error->message); + g_error_free(error); } +} - static void - msd_background_plugin_class_init (MsdBackgroundPluginClass* klass) - { - GObjectClass* object_class = G_OBJECT_CLASS(klass); - MateSettingsPluginClass* plugin_class = MATE_SETTINGS_PLUGIN_CLASS(klass); +static void +impl_deactivate (MateSettingsPlugin* plugin) +{ + g_debug("Deactivating background plugin"); - object_class->finalize = msd_background_plugin_finalize; + msd_background_manager_stop(MSD_BACKGROUND_PLUGIN(plugin)->priv->manager); +} - plugin_class->activate = impl_activate; - plugin_class->deactivate = impl_deactivate; +static void +msd_background_plugin_class_init (MsdBackgroundPluginClass* klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS(klass); + MateSettingsPluginClass* plugin_class = MATE_SETTINGS_PLUGIN_CLASS(klass); + + object_class->finalize = msd_background_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private(klass, sizeof(MsdBackgroundPluginPrivate)); +} + +static void +msd_background_plugin_class_finalize (MsdBackgroundPluginClass *klass) +{ +} - g_type_class_add_private(klass, sizeof(MsdBackgroundPluginPrivate)); - } -//}
\ No newline at end of file diff --git a/plugins/clipboard/msd-clipboard-plugin.c b/plugins/clipboard/msd-clipboard-plugin.c index a7e4d86..da00eda 100644 --- a/plugins/clipboard/msd-clipboard-plugin.c +++ b/plugins/clipboard/msd-clipboard-plugin.c @@ -102,3 +102,9 @@ msd_clipboard_plugin_class_init (MsdClipboardPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdClipboardPluginPrivate)); } + +static void +msd_clipboard_plugin_class_finalize (MsdClipboardPluginClass *klass) +{ +} + diff --git a/plugins/dummy/msd-dummy-plugin.c b/plugins/dummy/msd-dummy-plugin.c index 5fbbc0b..ff4046d 100644 --- a/plugins/dummy/msd-dummy-plugin.c +++ b/plugins/dummy/msd-dummy-plugin.c @@ -102,3 +102,8 @@ msd_dummy_plugin_class_init (MsdDummyPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdDummyPluginPrivate)); } + +static void +msd_dummy_plugin_class_finalize (MsdDummyPluginClass *klass) +{ +} diff --git a/plugins/font/Makefile.am b/plugins/font/Makefile.am deleted file mode 100644 index d0cf9ce..0000000 --- a/plugins/font/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -NULL = - -plugin_LTLIBRARIES = \ - libfont.la \ - $(NULL) - -libfont_la_SOURCES = \ - msd-font-plugin.h \ - msd-font-plugin.c \ - msd-font-manager.h \ - msd-font-manager.c \ - delayed-dialog.h \ - delayed-dialog.c \ - $(NULL) - -libfont_la_CPPFLAGS = \ - -I$(top_srcdir)/mate-settings-daemon \ - -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ - $(AM_CPPFLAGS) - -libfont_la_CFLAGS = \ - $(SETTINGS_PLUGIN_CFLAGS) \ - $(AM_CFLAGS) - -libfont_la_LDFLAGS = \ - $(MSD_PLUGIN_LDFLAGS) \ - $(NULL) - -libfont_la_LIBADD = \ - $(SETTINGS_PLUGIN_LIBS) \ - $(NULL) - -plugin_in_files = \ - font.mate-settings-plugin.in \ - $(NULL) - -plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin) - -EXTRA_DIST = \ - $(plugin_in_files) \ - $(NULL) - -CLEANFILES = \ - $(plugin_DATA) \ - $(NULL) - -DISTCLEANFILES = \ - $(plugin_DATA) \ - $(NULL) - -@MSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/font/delayed-dialog.c b/plugins/font/delayed-dialog.c deleted file mode 100644 index afec416..0000000 --- a/plugins/font/delayed-dialog.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright © 2006 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -#include <stdlib.h> -#include <string.h> - -#include <gtk/gtk.h> -#include <gdk/gdkx.h> - -#include "delayed-dialog.h" - -static gboolean delayed_show_timeout (gpointer data); -static GdkFilterReturn message_filter (GdkXEvent *xevent, - GdkEvent *event, - gpointer data); - -static GSList *dialogs = NULL; - -/** - * mate_settings_delayed_show_dialog: - * @dialog: the dialog - * - * Shows the dialog as with gtk_widget_show(), unless a window manager - * hasn't been started yet, in which case it will wait up to 5 seconds - * for that to happen before showing the dialog. - **/ -void -mate_settings_delayed_show_dialog (GtkWidget *dialog) -{ - GdkDisplay *display = gtk_widget_get_display (dialog); - Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); - GdkScreen *screen = gtk_widget_get_screen (dialog); - GdkAtom manager_atom; - char selection_name[10]; - Atom selection_atom; - - /* We can't use gdk_selection_owner_get() for this, because - * it's an unknown out-of-process window. - */ - snprintf (selection_name, sizeof (selection_name), "WM_S%d", - gdk_screen_get_number (screen)); - selection_atom = XInternAtom (xdisplay, selection_name, True); - if (selection_atom && - XGetSelectionOwner (xdisplay, selection_atom) != None) { - gtk_widget_show (dialog); - return; - } - - dialogs = g_slist_prepend (dialogs, dialog); - - manager_atom = gdk_atom_intern ("MANAGER", FALSE); - gdk_display_add_client_message_filter (display, manager_atom, - message_filter, NULL); - - g_timeout_add (5000, delayed_show_timeout, NULL); -} - -static gboolean -delayed_show_timeout (gpointer data) -{ - GSList *l; - - for (l = dialogs; l; l = l->next) - gtk_widget_show (l->data); - g_slist_free (dialogs); - dialogs = NULL; - - /* FIXME: There's no gdk_display_remove_client_message_filter */ - - return FALSE; -} - -static GdkFilterReturn -message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) -{ - XClientMessageEvent *evt = (XClientMessageEvent *)xevent; - char *selection_name = XGetAtomName (evt->display, evt->data.l[1]); - int screen; - GSList *l, *next; - - if (!dialogs) - return GDK_FILTER_CONTINUE; - - if (strncmp (selection_name, "WM_S", 4) != 0) { - XFree (selection_name); - return GDK_FILTER_CONTINUE; - } - - screen = atoi (selection_name + 4); - - for (l = dialogs; l; l = next) { - GtkWidget *dialog = l->data; - next = l->next; - - if (gdk_screen_get_number (gtk_widget_get_screen (dialog)) == screen) { - gtk_widget_show (dialog); - dialogs = g_slist_remove (dialogs, dialog); - } - } - - if (!dialogs) { - /* FIXME: There's no gdk_display_remove_client_message_filter */ - } - - return GDK_FILTER_CONTINUE; -} diff --git a/plugins/font/delayed-dialog.h b/plugins/font/delayed-dialog.h deleted file mode 100644 index 2bc2313..0000000 --- a/plugins/font/delayed-dialog.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright © 2006 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - - -#ifndef __DELAYED_DIALOG_H -#define __DELAYED_DIALOG_H - -#include <gtk/gtk.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void mate_settings_delayed_show_dialog (GtkWidget *dialog); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/plugins/font/font.mate-settings-plugin.in b/plugins/font/font.mate-settings-plugin.in deleted file mode 100644 index 6bb1c47..0000000 --- a/plugins/font/font.mate-settings-plugin.in +++ /dev/null @@ -1,8 +0,0 @@ -[MATE Settings Plugin] -Module=font -IAge=0 -_Name=Font -_Description=Font plugin -Authors=Rodrigo Moya -Copyright=Copyright © 2007 The MATE Foundation -Website= diff --git a/plugins/font/msd-font-manager.c b/plugins/font/msd-font-manager.c deleted file mode 100644 index 46206b4..0000000 --- a/plugins/font/msd-font-manager.c +++ /dev/null @@ -1,438 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 The MATE Foundation - * Copyright (C) 2007 William Jon McCann <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include <sys/types.h> -#include <sys/wait.h> -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> -#include <sys/stat.h> -#include <dirent.h> - -#include <locale.h> - -#include <X11/Xatom.h> - -#include <glib.h> -#include <glib/gi18n.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> -#include <gio/gio.h> - -#include "mate-settings-profile.h" -#include "msd-font-manager.h" -#include "delayed-dialog.h" - -static void msd_font_manager_class_init (MsdFontManagerClass *klass); -static void msd_font_manager_init (MsdFontManager *font_manager); - -G_DEFINE_TYPE (MsdFontManager, msd_font_manager, G_TYPE_OBJECT) - -static gpointer manager_object = NULL; - -static void -update_property (GString *props, const gchar* key, const gchar* value) -{ - gchar* needle; - size_t needle_len; - gchar* found = NULL; - - /* update an existing property */ - needle = g_strconcat (key, ":", NULL); - needle_len = strlen (needle); - if (g_str_has_prefix (props->str, needle)) - found = props->str; - else - found = strstr (props->str, needle); - - if (found) { - size_t value_index; - gchar* end; - - end = strchr (found, '\n'); - value_index = (found - props->str) + needle_len + 1; - g_string_erase (props, value_index, end ? (end - found - needle_len) : -1); - g_string_insert (props, value_index, "\n"); - g_string_insert (props, value_index, value); - } else { - g_string_append_printf (props, "%s:\t%s\n", key, value); - } -} - -static void -load_xcursor_theme (GSettings *settings) -{ - char *cursor_theme; - int size; - GString *add_string; - Display *dpy; - gchar numbuf[20]; - - mate_settings_profile_start (NULL); - - size = g_settings_get_int (settings, "cursor-size"); - if (size <= 0) { - return; - } - - cursor_theme = g_settings_get_string (settings, "cursor-theme"); - if (cursor_theme == NULL) { - return; - } - - /* get existing properties */ - dpy = XOpenDisplay (NULL); - g_return_if_fail (dpy != NULL); - add_string = g_string_new (XResourceManagerString (dpy)); - g_debug("load_xcursor_theme: existing res '%s'", add_string->str); - - update_property (add_string, "Xcursor.theme", cursor_theme); - update_property (add_string, "Xcursor.theme_core", "true"); - g_snprintf (numbuf, sizeof (numbuf), "%i", size); - update_property (add_string, "Xcursor.size", numbuf); - - g_debug("load_xcursor_theme: new res '%s'", add_string->str); - - /* Set the new X property */ - XChangeProperty(dpy, RootWindow (dpy, 0), - XA_RESOURCE_MANAGER, XA_STRING, 8, PropModeReplace, add_string->str, add_string->len); - XCloseDisplay (dpy); - - g_free (cursor_theme); - g_string_free (add_string, TRUE); - - mate_settings_profile_end (NULL); -} - -static char* setup_dir(const char* font_dir_name, gboolean create) -{ - #if GLIB_CHECK_VERSION(2, 6, 0) - char* font_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), "mate", "share", font_dir_name, NULL); - #else // glib version < 2.6.0 - char* font_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_home_dir(), ".config", "mate", "share", font_dir_name, NULL); - #endif - - if (create) - { - if (g_mkdir_with_parents(font_dir, 0755) != 0) - { - g_warning("Cannot create needed directory \"%s\".", font_dir); - g_free(font_dir); - font_dir = NULL; - } - } - else if (!g_file_test(font_dir, G_FILE_TEST_EXISTS)) - { - g_free (font_dir); - font_dir = NULL; - } - - return font_dir; -} - -static char * -empty_check_dir (char *font_dir) -{ - char *file_name; - - if (!font_dir) - return NULL; - - /* remove the fonts.dir and fonts.scale files that mkfontdir generates. */ - - file_name = g_build_filename (G_DIR_SEPARATOR_S, font_dir, "fonts.dir", NULL); - unlink (file_name); - g_free (file_name); - - file_name = g_build_filename (G_DIR_SEPARATOR_S, font_dir, "fonts.scale", NULL); - unlink (file_name); - g_free (file_name); - - /* if it's empty, get rid of it. */ - if (0 == rmdir (font_dir)) { - g_free (font_dir); - font_dir = NULL; - } - - return font_dir; -} - -static char* -setup_font_dir (GSettings *settings) -{ - return empty_check_dir (setup_dir ("fonts", FALSE)); -} - -static char* -setup_cursor_dir (GSettings *settings) -{ - char *cursor_dir; - char *cursor_font; - DIR *dir; - struct dirent *file_dirent; - - cursor_font = g_settings_get_string (settings, "cursor-font"); - if (cursor_font != NULL) { - if (!g_path_is_absolute (cursor_font) || - !g_file_test (cursor_font, G_FILE_TEST_IS_REGULAR)) { - /* font file is not usable */ - g_free (cursor_font); - cursor_font = NULL; - } - } - - cursor_dir = setup_dir ("cursor-fonts", cursor_font != NULL); - - /* remove previously made symlinks, if any */ - if (cursor_dir) { - dir = opendir (cursor_dir); - while ((file_dirent = readdir (dir)) != NULL) { - struct stat st; - char *link_name; - - link_name = g_build_filename (cursor_dir, file_dirent->d_name, NULL); - if (lstat (link_name, &st)) { - g_free (link_name); - continue; - } - g_free (link_name); - - if (S_ISLNK (st.st_mode)) - unlink (link_name); - } - closedir (dir); - } - - if (cursor_font && cursor_dir) { - char *newpath; - char *font_name; - - font_name = strrchr (cursor_font, G_DIR_SEPARATOR); - newpath = g_build_filename (cursor_dir, font_name, NULL); - symlink (cursor_font, newpath); - g_free (newpath); - g_free (cursor_font); - cursor_font = NULL; - } else { - cursor_dir = empty_check_dir (cursor_dir); - } - - return cursor_dir; -} - -static void -load_font_paths (GSettings *settings) -{ - char *font_dir_name; - char *cursor_dir_name; - - char **font_path; - char **new_font_path; - int n_fonts; - int new_n_fonts; - - int i; - - const char *argv[4]; - int argc = 0; - - mate_settings_profile_start (NULL); - - font_dir_name = setup_font_dir (settings); - cursor_dir_name = setup_cursor_dir (settings); - - if (font_dir_name == NULL && cursor_dir_name == NULL) - goto done; - - /* run mkfontdir */ - argv[argc++] = "mkfontdir"; - if (font_dir_name) - argv[argc++] = font_dir_name; - if (cursor_dir_name) - argv[argc++] = cursor_dir_name; - argv[argc] = NULL; - g_spawn_sync (NULL, /* current dir */ - (char **) (void *) argv, NULL /* envp */, - G_SPAWN_SEARCH_PATH, - NULL, NULL, /* child_setup */ - NULL, NULL, NULL, NULL); - - /* Set the font path */ - font_path = XGetFontPath (gdk_x11_get_default_xdisplay (), &n_fonts); - new_n_fonts = n_fonts; - if (cursor_dir_name && (n_fonts == 0 || strcmp (font_path[0], cursor_dir_name))) - new_n_fonts++; - if (font_dir_name && (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))) - new_n_fonts++; - - if (new_n_fonts == n_fonts) - new_font_path = font_path; - else { - new_font_path = g_new0 (char *, new_n_fonts); - - if (cursor_dir_name && (n_fonts == 0 || strcmp (font_path[0], cursor_dir_name))) { - new_font_path[0] = cursor_dir_name; - for (i = 0; i < n_fonts; i++) - new_font_path [i+1] = font_path [i]; - } else { - for (i = 0; i < n_fonts; i++) - new_font_path [i] = font_path [i]; - } - - if (font_dir_name && (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))) { - new_font_path[new_n_fonts-1] = font_dir_name; - } - } - - /* We set font path even if it was not changed, to enforce dropping - * caches in the server */ - gdk_error_trap_push (); - XSetFontPath (gdk_display, new_font_path, new_n_fonts); - gdk_flush (); - - /* if there was an error setting the new path, revert */ - if (gdk_error_trap_pop ()) { - XSetFontPath (gdk_display, font_path, n_fonts); - } - - g_free (font_dir_name); - g_free (cursor_dir_name); - - if (new_font_path != font_path) - g_free (new_font_path); - - XFreeFontPath (font_path); - -done: - mate_settings_profile_end (NULL); -} - -gboolean -msd_font_manager_start (MsdFontManager *manager, - GError **error) -{ - GSettings *settings; - - g_debug ("Starting font manager"); - mate_settings_profile_start (NULL); - - settings = g_settings_new ("org.mate.peripherals-mouse"); - - load_xcursor_theme (settings); - load_font_paths (settings); - - g_object_unref (settings); - - mate_settings_profile_end (NULL); - - return TRUE; -} - -void -msd_font_manager_stop (MsdFontManager *manager) -{ - g_debug ("Stopping font manager"); -} - -static void -msd_font_manager_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - MsdFontManager *self; - - self = MSD_FONT_MANAGER (object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -msd_font_manager_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - MsdFontManager *self; - - self = MSD_FONT_MANAGER (object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GObject * -msd_font_manager_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) -{ - MsdFontManager *font_manager; - MsdFontManagerClass *klass; - - klass = MSD_FONT_MANAGER_CLASS (g_type_class_peek (MSD_TYPE_FONT_MANAGER)); - - font_manager = MSD_FONT_MANAGER (G_OBJECT_CLASS (msd_font_manager_parent_class)->constructor (type, - n_construct_properties, - construct_properties)); - - return G_OBJECT (font_manager); -} - -static void -msd_font_manager_class_init (MsdFontManagerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->get_property = msd_font_manager_get_property; - object_class->set_property = msd_font_manager_set_property; - object_class->constructor = msd_font_manager_constructor; -} - -static void -msd_font_manager_init (MsdFontManager *manager) -{ -} - -MsdFontManager * -msd_font_manager_new (void) -{ - if (manager_object != NULL) { - g_object_ref (manager_object); - } else { - manager_object = g_object_new (MSD_TYPE_FONT_MANAGER, NULL); - g_object_add_weak_pointer (manager_object, - (gpointer *) &manager_object); - } - - return MSD_FONT_MANAGER (manager_object); -} diff --git a/plugins/font/msd-font-manager.h b/plugins/font/msd-font-manager.h deleted file mode 100644 index 6a87baf..0000000 --- a/plugins/font/msd-font-manager.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef __MSD_FONT_MANAGER_H -#define __MSD_FONT_MANAGER_H - -#include <glib-object.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define MSD_TYPE_FONT_MANAGER (msd_font_manager_get_type ()) -#define MSD_FONT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_FONT_MANAGER, MsdFontManager)) -#define MSD_FONT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MSD_TYPE_FONT_MANAGER, MsdFontManagerClass)) -#define MSD_IS_FONT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MSD_TYPE_FONT_MANAGER)) -#define MSD_IS_FONT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_FONT_MANAGER)) -#define MSD_FONT_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_FONT_MANAGER, MsdFontManagerClass)) - -typedef struct MsdFontManagerPrivate MsdFontManagerPrivate; - -typedef struct -{ - GObject parent; - MsdFontManagerPrivate *priv; -} MsdFontManager; - -typedef struct -{ - GObjectClass parent_class; -} MsdFontManagerClass; - -GType msd_font_manager_get_type (void); - -MsdFontManager * msd_font_manager_new (void); -gboolean msd_font_manager_start (MsdFontManager *manager, - GError **error); -void msd_font_manager_stop (MsdFontManager *manager); - -#ifdef __cplusplus -} -#endif - -#endif /* __MSD_FONT_MANAGER_H */ diff --git a/plugins/font/msd-font-plugin.c b/plugins/font/msd-font-plugin.c deleted file mode 100644 index b6a4452..0000000 --- a/plugins/font/msd-font-plugin.c +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include <glib/gi18n-lib.h> -#include <gmodule.h> - -#include "mate-settings-plugin.h" -#include "msd-font-plugin.h" -#include "msd-font-manager.h" - -struct MsdFontPluginPrivate { - MsdFontManager *manager; -}; - -#define MSD_FONT_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), MSD_TYPE_FONT_PLUGIN, MsdFontPluginPrivate)) - -MATE_SETTINGS_PLUGIN_REGISTER (MsdFontPlugin, msd_font_plugin) - -static void -msd_font_plugin_init (MsdFontPlugin *plugin) -{ - plugin->priv = MSD_FONT_PLUGIN_GET_PRIVATE (plugin); - - g_debug ("MsdFontPlugin initializing"); - - plugin->priv->manager = msd_font_manager_new (); -} - -static void -msd_font_plugin_finalize (GObject *object) -{ - MsdFontPlugin *plugin; - - g_return_if_fail (object != NULL); - g_return_if_fail (MSD_IS_FONT_PLUGIN (object)); - - g_debug ("MsdFontPlugin finalizing"); - - plugin = MSD_FONT_PLUGIN (object); - - g_return_if_fail (plugin->priv != NULL); - - if (plugin->priv->manager != NULL) { - g_object_unref (plugin->priv->manager); - } - - G_OBJECT_CLASS (msd_font_plugin_parent_class)->finalize (object); -} - -static void -impl_activate (MateSettingsPlugin *plugin) -{ - gboolean res; - GError *error; - - g_debug ("Activating font plugin"); - - error = NULL; - res = msd_font_manager_start (MSD_FONT_PLUGIN (plugin)->priv->manager, &error); - if (! res) { - g_warning ("Unable to start font manager: %s", error->message); - g_error_free (error); - } -} - -static void -impl_deactivate (MateSettingsPlugin *plugin) -{ - g_debug ("Deactivating font plugin"); - msd_font_manager_stop (MSD_FONT_PLUGIN (plugin)->priv->manager); -} - -static void -msd_font_plugin_class_init (MsdFontPluginClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass); - - object_class->finalize = msd_font_plugin_finalize; - - plugin_class->activate = impl_activate; - plugin_class->deactivate = impl_deactivate; - - g_type_class_add_private (klass, sizeof (MsdFontPluginPrivate)); -} diff --git a/plugins/font/msd-font-plugin.h b/plugins/font/msd-font-plugin.h deleted file mode 100644 index ea6e775..0000000 --- a/plugins/font/msd-font-plugin.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef __MSD_FONT_PLUGIN_H__ -#define __MSD_FONT_PLUGIN_H__ - -#include <glib.h> -#include <glib-object.h> -#include <gmodule.h> - -#include "mate-settings-plugin.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define MSD_TYPE_FONT_PLUGIN (msd_font_plugin_get_type ()) -#define MSD_FONT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_FONT_PLUGIN, MsdFontPlugin)) -#define MSD_FONT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MSD_TYPE_FONT_PLUGIN, MsdFontPluginClass)) -#define MSD_IS_FONT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MSD_TYPE_FONT_PLUGIN)) -#define MSD_IS_FONT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_FONT_PLUGIN)) -#define MSD_FONT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_FONT_PLUGIN, MsdFontPluginClass)) - -typedef struct MsdFontPluginPrivate MsdFontPluginPrivate; - -typedef struct -{ - MateSettingsPlugin parent; - MsdFontPluginPrivate *priv; -} MsdFontPlugin; - -typedef struct -{ - MateSettingsPluginClass parent_class; -} MsdFontPluginClass; - -GType msd_font_plugin_get_type (void) G_GNUC_CONST; - -/* All the plugins must implement this function */ -G_MODULE_EXPORT GType register_mate_settings_plugin (GTypeModule *module); - -#ifdef __cplusplus -} -#endif - -#endif /* __MSD_FONT_PLUGIN_H__ */ diff --git a/plugins/housekeeping/msd-disk-space.c b/plugins/housekeeping/msd-disk-space.c index f419658..3065b39 100644 --- a/plugins/housekeeping/msd-disk-space.c +++ b/plugins/housekeeping/msd-disk-space.c @@ -35,7 +35,6 @@ #include <gio/gunixmounts.h> #include <gio/gio.h> #include <gtk/gtk.h> -#include <gio/gio.h> #include "msd-disk-space.h" #include "msd-ldsm-dialog.h" diff --git a/plugins/housekeeping/msd-housekeeping-plugin.c b/plugins/housekeeping/msd-housekeeping-plugin.c index 9d5c407..40cd547 100644 --- a/plugins/housekeeping/msd-housekeeping-plugin.c +++ b/plugins/housekeeping/msd-housekeeping-plugin.c @@ -102,3 +102,9 @@ msd_housekeeping_plugin_class_init (MsdHousekeepingPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdHousekeepingPluginPrivate)); } + +static void +msd_housekeeping_plugin_class_finalize (MsdHousekeepingPluginClass *klass) +{ +} + diff --git a/plugins/housekeeping/msd-ldsm-trash-empty.c b/plugins/housekeeping/msd-ldsm-trash-empty.c index e218d6d..af01aa1 100644 --- a/plugins/housekeeping/msd-ldsm-trash-empty.c +++ b/plugins/housekeeping/msd-ldsm-trash-empty.c @@ -18,7 +18,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <gio/gio.h> #include <glib/gi18n.h> #include <gio/gio.h> diff --git a/plugins/keyboard/Makefile.am b/plugins/keyboard/Makefile.am index 327ad7e..1d2c93e 100644 --- a/plugins/keyboard/Makefile.am +++ b/plugins/keyboard/Makefile.am @@ -13,9 +13,6 @@ icons_DATA = \ kbd-capslock-off.png kbd-numlock-off.png kbd-scrolllock-off.png \ kbd-capslock-on.png kbd-numlock-on.png kbd-scrolllock-on.png -uidir = $(pkgdatadir) -ui_DATA = modmap-dialog.ui - libkeyboard_la_SOURCES = \ msd-keyboard-plugin.h \ msd-keyboard-plugin.c \ @@ -23,8 +20,6 @@ libkeyboard_la_SOURCES = \ msd-keyboard-manager.c \ msd-keyboard-xkb.h \ msd-keyboard-xkb.c \ - msd-xmodmap.h \ - msd-xmodmap.c \ delayed-dialog.h \ delayed-dialog.c \ $(NULL) diff --git a/plugins/keyboard/modmap-dialog.ui b/plugins/keyboard/modmap-dialog.ui deleted file mode 100644 index 73d5a57..0000000 --- a/plugins/keyboard/modmap-dialog.ui +++ /dev/null @@ -1,257 +0,0 @@ -<?xml version="1.0"?> -<interface> - <!-- interface-requires gtk+ 2.6 --> - <!-- interface-naming-policy toplevel-contextual --> - <object class="GtkDialog" id="dialog1"> - <property name="visible">True</property> - <property name="title" translatable="yes">Load modmap files</property> - <property name="type_hint">dialog</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox4"> - <property name="visible">True</property> - <child> - <object class="GtkVBox" id="vbox44"> - <property name="visible">True</property> - <child> - <object class="GtkLabel" id="label62"> - <property name="visible">True</property> - <property name="label" translatable="yes">Would you like to load the modmap files?</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox32"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="spacing">6</property> - <child> - <object class="GtkVBox" id="vbox45"> - <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label63"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Loaded files:</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow7"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <property name="shadow_type">in</property> - <child> - <object class="GtkTreeView" id="treeview1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - </object> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox46"> - <property name="visible">True</property> - <property name="border_width">6</property> - <property name="spacing">12</property> - <child> - <object class="GtkLabel" id="label64"> - <property name="visible">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button7"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <child> - <object class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <child> - <object class="GtkHBox" id="hbox33"> - <property name="visible">True</property> - <property name="spacing">2</property> - <child> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-add</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label66"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Load</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button6"> - <property name="label">gtk-remove</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox47"> - <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label65"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">A_vailable files:</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow8"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <property name="shadow_type">in</property> - <child> - <object class="GtkTreeView" id="treeview2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - </object> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area3"> - <property name="visible">True</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="helpbutton2"> - <property name="label">gtk-help</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="okbutton1"> - <property name="label">gtk-ok</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="-11">helpbutton2</action-widget> - <action-widget response="-5">okbutton1</action-widget> - </action-widgets> - </object> -</interface> diff --git a/plugins/keyboard/msd-keyboard-manager.c b/plugins/keyboard/msd-keyboard-manager.c index 293fb18..a4b97e5 100644 --- a/plugins/keyboard/msd-keyboard-manager.c +++ b/plugins/keyboard/msd-keyboard-manager.c @@ -50,7 +50,6 @@ #include "msd-keyboard-manager.h" #include "msd-keyboard-xkb.h" -#include "msd-xmodmap.h" #define MSD_KEYBOARD_MANAGER_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE((o), MSD_TYPE_KEYBOARD_MANAGER, MsdKeyboardManagerPrivate)) @@ -333,7 +332,6 @@ start_keyboard_idle_cb (MsdKeyboardManager *manager) manager->priv->settings = g_settings_new (MSD_KEYBOARD_SCHEMA); /* Essential - xkb initialization should happen before */ - msd_keyboard_xkb_set_post_activation_callback ((PostActivationCallback) msd_load_modmap_files, NULL); msd_keyboard_xkb_init (manager); #ifdef HAVE_X11_EXTENSIONS_XKB_H diff --git a/plugins/keyboard/msd-keyboard-plugin.c b/plugins/keyboard/msd-keyboard-plugin.c index 310c74c..97ad9ef 100644 --- a/plugins/keyboard/msd-keyboard-plugin.c +++ b/plugins/keyboard/msd-keyboard-plugin.c @@ -102,3 +102,9 @@ msd_keyboard_plugin_class_init (MsdKeyboardPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdKeyboardPluginPrivate)); } + +static void +msd_keyboard_plugin_class_finalize (MsdKeyboardPluginClass *klass) +{ +} + diff --git a/plugins/keyboard/msd-keyboard-xkb.c b/plugins/keyboard/msd-keyboard-xkb.c index 29cc066..d922210 100644 --- a/plugins/keyboard/msd-keyboard-xkb.c +++ b/plugins/keyboard/msd-keyboard-xkb.c @@ -37,7 +37,6 @@ #include <libmatekbd/matekbd-keyboard-config.h> #include <libmatekbd/matekbd-util.h> -#include "msd-xmodmap.h" #include "msd-keyboard-xkb.h" #include "delayed-dialog.h" #include "mate-settings-profile.h" @@ -501,88 +500,6 @@ msd_keyboard_xkb_analyze_sysconfig (void) NULL); } -static gboolean -msd_chk_file_list (void) -{ - GDir *home_dir; - const char *fname; - GSList *file_list = NULL; - GSList *last_login_file_list = NULL; - GSList *tmp = NULL; - GSList *tmp_l = NULL; - gboolean new_file_exist = FALSE; - - home_dir = g_dir_open (g_get_home_dir (), 0, NULL); - while ((fname = g_dir_read_name (home_dir)) != NULL) { - if (g_strrstr (fname, "modmap")) { - file_list = - g_slist_append (file_list, g_strdup (fname)); - } - } - g_dir_close (home_dir); - - gchar **settings_list; - settings_list = g_settings_get_strv (settings_desktop, KNOWN_FILES_KEY); - if (settings_list != NULL) { - gint i; - for (i = 0; i < G_N_ELEMENTS (settings_list); i++) { - if (settings_list[i] != NULL) - last_login_file_list = - g_slist_append (last_login_file_list, g_strdup (settings_list[i])); - } - g_strfreev (settings_list); - } - - /* Compare between the two file list, currently available modmap files - and the files available in the last log in */ - tmp = file_list; - while (tmp != NULL) { - tmp_l = last_login_file_list; - new_file_exist = TRUE; - while (tmp_l != NULL) { - if (strcmp (tmp->data, tmp_l->data) == 0) { - new_file_exist = FALSE; - break; - } else { - tmp_l = tmp_l->next; - } - } - if (new_file_exist) { - break; - } else { - tmp = tmp->next; - } - } - - if (new_file_exist) { - GSList *l; - GPtrArray *array = g_ptr_array_new (); - for (l = file_list; l != NULL; l = l->next) - g_ptr_array_add (array, l->data); - g_ptr_array_add (array, NULL); - g_settings_set_strv (settings_desktop, KNOWN_FILES_KEY, (const gchar **) array->pdata); - g_ptr_array_free (array, FALSE); - } - - g_slist_foreach (file_list, (GFunc) g_free, NULL); - g_slist_free (file_list); - - g_slist_foreach (last_login_file_list, (GFunc) g_free, NULL); - g_slist_free (last_login_file_list); - - return new_file_exist; - -} - -static void -msd_keyboard_xkb_chk_lcl_xmm (void) -{ - if (msd_chk_file_list ()) { - msd_modmap_dialog_call (); - } - msd_load_modmap_files (); -} - void msd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, void *user_data) @@ -695,11 +612,6 @@ msd_keyboard_xkb_init (MsdKeyboardManager * kbd_manager) xkl_engine); xkl_engine_backup_names_prop (xkl_engine); msd_keyboard_xkb_analyze_sysconfig (); - mate_settings_profile_start - ("msd_keyboard_xkb_chk_lcl_xmm"); - msd_keyboard_xkb_chk_lcl_xmm (); - mate_settings_profile_end - ("msd_keyboard_xkb_chk_lcl_xmm"); g_signal_connect (settings_desktop, "changed", G_CALLBACK(apply_desktop_settings_cb), NULL); g_signal_connect (settings_kbd, "changed", G_CALLBACK(apply_xkb_settings_cb), NULL); diff --git a/plugins/keyboard/msd-xmodmap.c b/plugins/keyboard/msd-xmodmap.c deleted file mode 100644 index 5bea2da..0000000 --- a/plugins/keyboard/msd-xmodmap.c +++ /dev/null @@ -1,406 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright © 2005 Novell Inc. - * - * Written by Shakti Sen <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -#include "config.h" - -#include <string.h> - -#include <glib.h> -#include <gtk/gtk.h> -#include <gio/gio.h> - -#include "msd-xmodmap.h" - -#define KEYBOARD_SCHEMA "org.mate.peripherals-keyboard-xkb.general" -#define LOADED_FILES_KEY "update-handlers" - -void -msd_load_modmap_files (void) -{ - GSettings *settings; - GSList *tmp = NULL; - GSList *loaded_file_list = NULL; - gchar **settings_list; - gint i; - - settings = g_settings_new (KEYBOARD_SCHEMA); - settings_list = g_settings_get_strv (settings, LOADED_FILES_KEY); - - if (settings_list != NULL) { - for (i = 0; settings_list[i] != NULL; i++) { - loaded_file_list = - g_slist_append (loaded_file_list, g_strdup (settings_list[i])); - } - for (tmp = loaded_file_list; tmp != NULL; tmp = tmp->next) { - gchar *file; - gchar *command; - - file = g_build_filename (g_get_home_dir (), (gchar *) tmp->data, NULL); - command = g_strconcat ("xmodmap ", file, NULL); - g_free (file); - - g_spawn_command_line_async (command, NULL); - - g_free (command); - g_free (tmp->data); - } - g_strfreev (settings_list); - g_slist_free (loaded_file_list); - } - g_object_unref (settings); -} - -static void -response_callback (GtkWidget *dialog, - int id, - void *data) -{ - if (id == GTK_RESPONSE_OK) { - msd_load_modmap_files (); - } - gtk_widget_destroy (dialog); -} - -static void -get_selected_files_func (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) -{ - GSList **list = data; - gchar *filename; - - filename = NULL; - gtk_tree_model_get (model, - iter, - 0, - &filename, - -1); - - *list = g_slist_prepend (*list, filename); -} - -static GSList* -remove_string_from_list (GSList *list, - const char *str) -{ - GSList *tmp; - - for (tmp = list; tmp != NULL; tmp = tmp->next) { - if (strcmp (tmp->data, str) == 0) { - g_free (tmp->data); - list = g_slist_delete_link (list, tmp); - break; - } - } - - return list; -} - - -static void -remove_button_clicked_callback (GtkWidget *button, - void *data) -{ - GtkWidget *dialog; - GtkListStore *tree = NULL; - GtkTreeSelection *selection; - GtkWidget *treeview; - GSettings *settings; - GSList *filenames = NULL; - GSList *tmp = NULL; - GSList *loaded_files = NULL; - - dialog = data; - - treeview = g_object_get_data (G_OBJECT (dialog), "treeview1"); - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - gtk_tree_selection_selected_foreach (selection, - get_selected_files_func, - &filenames); - - if (!filenames) - return; - - /* Remove the selected file */ - - settings = g_settings_new (KEYBOARD_SCHEMA); - - gchar **settings_list; - settings_list = g_settings_get_strv (settings, LOADED_FILES_KEY); - if (settings_list != NULL) { - gint i; - for (i = 0; i < G_N_ELEMENTS (settings_list); i++) { - if (settings_list[i] != NULL) - loaded_files = - g_slist_append (loaded_files, g_strdup (settings_list[i])); - } - g_strfreev (settings_list); - } - - loaded_files = remove_string_from_list (loaded_files, (char *)filenames->data); - - GSList *l; - GPtrArray *array = g_ptr_array_new (); - for (l = loaded_files; l != NULL; l = l->next) - g_ptr_array_add (array, l->data); - g_ptr_array_add (array, NULL); - g_settings_set_strv (settings, LOADED_FILES_KEY, (const gchar **) array->pdata); - g_ptr_array_free (array, FALSE); - - g_object_unref (settings); - - tree = g_object_get_data (G_OBJECT (dialog), "tree"); - - gtk_list_store_clear (tree); - for (tmp = loaded_files; tmp != NULL; tmp = tmp->next) { - GtkTreeIter iter; - gtk_list_store_append (tree, &iter); - gtk_list_store_set (tree, &iter, - 0, - tmp->data, - -1); - } - - g_slist_foreach (loaded_files, (GFunc) g_free, NULL); - g_slist_free (loaded_files); -} - -static void -load_button_clicked_callback (GtkWidget *button, - void *data) -{ - GtkWidget *dialog; - GtkListStore *tree = NULL; - GtkTreeSelection *selection; - GtkWidget *treeview; - GSList *filenames = NULL; - GSList *tmp = NULL; - GSList *loaded_files = NULL; - GSettings *settings; - - dialog = data; - - treeview = g_object_get_data (G_OBJECT (dialog), - "loaded-treeview"); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - gtk_tree_selection_selected_foreach (selection, - get_selected_files_func, - &filenames); - - if (!filenames) - return; - - /* Add the files to left-tree-view */ - settings = g_settings_new (KEYBOARD_SCHEMA); - - gchar **settings_list; - settings_list = g_settings_get_strv (settings, LOADED_FILES_KEY); - if (settings_list != NULL) { - gint i; - for (i = 0; i < G_N_ELEMENTS (settings_list); i++) { - if (settings_list[i] != NULL) - loaded_files = - g_slist_append (loaded_files, g_strdup (settings_list[i])); - } - g_strfreev (settings_list); - } - - if (g_slist_find_custom (loaded_files, filenames->data, (GCompareFunc) strcmp)) { - g_free (filenames->data); - g_slist_free (filenames); - goto out; - } - - loaded_files = g_slist_append (loaded_files, filenames->data); - - GSList *l; - GPtrArray *array = g_ptr_array_new (); - for (l = loaded_files; l != NULL; l = l->next) - g_ptr_array_add (array, l->data); - g_ptr_array_add (array, NULL); - g_settings_set_strv (settings, LOADED_FILES_KEY, (const gchar **) array->pdata); - g_ptr_array_free (array, FALSE); - - tree = g_object_get_data (G_OBJECT (dialog), "tree"); - - gtk_list_store_clear (tree); - for (tmp = loaded_files; tmp != NULL; tmp = tmp->next) { - GtkTreeIter iter; - gtk_list_store_append (tree, &iter); - gtk_list_store_set (tree, &iter, - 0, - tmp->data, - -1); - } - -out: - g_object_unref (settings); - g_slist_foreach (loaded_files, (GFunc) g_free, NULL); - g_slist_free (loaded_files); -} - -void -msd_modmap_dialog_call (void) -{ - GtkBuilder *builder; - guint res; - GError *error; - GtkWidget *load_dialog; - GtkListStore *tree; - GtkCellRenderer *cell_renderer; - GtkTreeIter parent_iter; - GtkTreeIter iter; - GtkTreeModel *sort_model; - GtkTreeSelection *selection; - GtkWidget *treeview; - GtkWidget *treeview1; - GtkTreeViewColumn *column; - GtkWidget *add_button; - GtkWidget *remove_button; - GSList *tmp; - GDir *homeDir; - GSList *loaded_files; - const char *fname; - GSettings *settings; - - homeDir = g_dir_open (g_get_home_dir (), 0, NULL); - if (homeDir == NULL) - return; - - error = NULL; - builder = gtk_builder_new (); - res = gtk_builder_add_from_file (builder, - DATADIR "/modmap-dialog.ui", - &error); - - if (res == 0) { - g_warning ("Could not load UI file: %s", error->message); - g_error_free (error); - g_object_unref (builder); - g_dir_close (homeDir); - return; - } - - load_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "dialog1")); - gtk_window_set_modal (GTK_WINDOW (load_dialog), TRUE); - g_signal_connect (load_dialog, - "response", - G_CALLBACK (response_callback), - builder); - add_button = GTK_WIDGET (gtk_builder_get_object (builder, "button7")); - g_signal_connect (add_button, - "clicked", - G_CALLBACK (load_button_clicked_callback), - load_dialog); - remove_button = GTK_WIDGET (gtk_builder_get_object (builder, - "button6")); - g_signal_connect (remove_button, - "clicked", - G_CALLBACK (remove_button_clicked_callback), - load_dialog); - treeview = GTK_WIDGET (gtk_builder_get_object (builder, "treeview1")); - g_object_set_data (G_OBJECT (load_dialog), "treeview1", treeview); - treeview = GTK_WIDGET (gtk_builder_get_object (builder, "treeview2")); - g_object_set_data (G_OBJECT (load_dialog), "loaded-treeview", treeview); - tree = gtk_list_store_new (1, G_TYPE_STRING); - cell_renderer = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes ("modmap", - cell_renderer, - "text", 0, - NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); - gtk_tree_view_column_set_sort_column_id (column, 0); - - /* Add the data */ - while ((fname = g_dir_read_name (homeDir)) != NULL) { - if (g_strrstr (fname, "modmap")) { - gtk_list_store_append (tree, &parent_iter); - gtk_list_store_set (tree, &parent_iter, - 0, - fname, - -1); - } - } - sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (tree)); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model), - 0, - GTK_SORT_ASCENDING); - gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), sort_model); - g_object_unref (G_OBJECT (tree)); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection), - GTK_SELECTION_MULTIPLE); - gtk_widget_show (load_dialog); - - g_dir_close (homeDir); - - /* Left treeview */ - treeview1 = GTK_WIDGET (gtk_builder_get_object (builder, "treeview1")); - tree = gtk_list_store_new (1, G_TYPE_STRING); - cell_renderer = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes ("modmap", - cell_renderer, - "text", 0, - NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (treeview1), column); - gtk_tree_view_column_set_sort_column_id (column, 0); - - settings = g_settings_new (KEYBOARD_SCHEMA); - - gchar **settings_list; - settings_list = g_settings_get_strv (settings, LOADED_FILES_KEY); - if (settings_list != NULL) { - gint i; - for (i = 0; i < G_N_ELEMENTS (settings_list); i++) { - if (settings_list[i] != NULL) - loaded_files = - g_slist_append (loaded_files, g_strdup (settings_list[i])); - } - g_strfreev (settings_list); - } - - /* Add the data */ - for (tmp = loaded_files; tmp != NULL; tmp = tmp->next) { - gtk_list_store_append (tree, &iter); - gtk_list_store_set (tree, &iter, - 0, - tmp->data, - -1); - } - - g_slist_foreach (loaded_files, (GFunc) g_free, NULL); - g_slist_free (loaded_files); - - sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (tree)); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model), - 0, - GTK_SORT_ASCENDING); - gtk_tree_view_set_model (GTK_TREE_VIEW (treeview1), sort_model); - g_object_unref (G_OBJECT (tree)); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview1)); - gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection), - GTK_SELECTION_MULTIPLE); - g_object_set_data (G_OBJECT (load_dialog), "tree", tree); - g_object_unref (builder); -} diff --git a/plugins/keyboard/msd-xmodmap.h b/plugins/keyboard/msd-xmodmap.h deleted file mode 100644 index 4316edb..0000000 --- a/plugins/keyboard/msd-xmodmap.h +++ /dev/null @@ -1,29 +0,0 @@ -/* mate-settings-xmodmap.h - * - * Copyright © 2005 Novell Inc. - * - * Written by Shakti Sen <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -#ifndef XMODMAP_H -#define XMODMAP_H - -void msd_load_modmap_files (void); -void msd_modmap_dialog_call (void); - -#endif diff --git a/plugins/media-keys/cut-n-paste/gvc-channel-map.c b/plugins/media-keys/cut-n-paste/gvc-channel-map.c index 6748d57..e35e793 100644 --- a/plugins/media-keys/cut-n-paste/gvc-channel-map.c +++ b/plugins/media-keys/cut-n-paste/gvc-channel-map.c @@ -25,7 +25,7 @@ #include <unistd.h> #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <pulse/pulseaudio.h> @@ -33,14 +33,6 @@ #define GVC_CHANNEL_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_CHANNEL_MAP, GvcChannelMapPrivate)) -#ifndef PA_CHECK_VERSION -#define PA_CHECK_VERSION(major,minor,micro) \ - ((PA_MAJOR > (major)) || \ - (PA_MAJOR == (major) && PA_MINOR > (minor)) || \ - (PA_MAJOR == (major) && PA_MINOR == (minor) && PA_MICRO >= (micro))) -#endif - - struct GvcChannelMapPrivate { pa_channel_map pa_map; @@ -49,7 +41,6 @@ struct GvcChannelMapPrivate gdouble extern_volume[NUM_TYPES]; /* volume, balance, fade, lfe */ gboolean can_balance; gboolean can_fade; - gboolean has_lfe; }; enum { @@ -65,46 +56,8 @@ static void gvc_channel_map_finalize (GObject *object); G_DEFINE_TYPE (GvcChannelMap, gvc_channel_map, G_TYPE_OBJECT) -/* FIXME remove when we depend on a newer PA */ -static int -gvc_pa_channel_map_has_position (const pa_channel_map *map, pa_channel_position_t p) { - unsigned c; - - g_return_val_if_fail(pa_channel_map_valid(map), 0); - g_return_val_if_fail(p < PA_CHANNEL_POSITION_MAX, 0); - - for (c = 0; c < map->channels; c++) - if (map->map[c] == p) - return 1; - - return 0; -} - -#if !PA_CHECK_VERSION(0,9,16) -/* The PulseAudio master increase version only when tagged, so let's avoid clashing with pa_ namespace */ -#define pa_cvolume_get_position gvc_cvolume_get_position -static pa_volume_t -gvc_cvolume_get_position (pa_cvolume *cv, const pa_channel_map *map, pa_channel_position_t t) { - unsigned c; - pa_volume_t v = PA_VOLUME_MUTED; - - g_assert(cv); - g_assert(map); - - g_return_val_if_fail(pa_cvolume_compatible_with_channel_map(cv, map), PA_VOLUME_MUTED); - g_return_val_if_fail(t < PA_CHANNEL_POSITION_MAX, PA_VOLUME_MUTED); - - for (c = 0; c < map->channels; c++) - if (map->map[c] == t) - if (cv->values[c] > v) - v = cv->values[c]; - - return v; -} -#endif - guint -gvc_channel_map_get_num_channels (GvcChannelMap *map) +gvc_channel_map_get_num_channels (const GvcChannelMap *map) { g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), 0); @@ -140,7 +93,7 @@ gvc_channel_map_get_volume (GvcChannelMap *map) } gboolean -gvc_channel_map_can_balance (GvcChannelMap *map) +gvc_channel_map_can_balance (const GvcChannelMap *map) { g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE); @@ -148,7 +101,7 @@ gvc_channel_map_can_balance (GvcChannelMap *map) } gboolean -gvc_channel_map_can_fade (GvcChannelMap *map) +gvc_channel_map_can_fade (const GvcChannelMap *map) { g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE); @@ -156,7 +109,7 @@ gvc_channel_map_can_fade (GvcChannelMap *map) } const char * -gvc_channel_map_get_mapping (GvcChannelMap *map) +gvc_channel_map_get_mapping (const GvcChannelMap *map) { g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL); @@ -167,15 +120,16 @@ gvc_channel_map_get_mapping (GvcChannelMap *map) } gboolean -gvc_channel_map_has_lfe (GvcChannelMap *map) +gvc_channel_map_has_position (const GvcChannelMap *map, + pa_channel_position_t position) { g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE); - return map->priv->has_lfe; + return pa_channel_map_has_position (&(map->priv->pa_map), position); } const pa_channel_map * -gvc_channel_map_get_pa_channel_map (GvcChannelMap *map) +gvc_channel_map_get_pa_channel_map (const GvcChannelMap *map) { g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL); @@ -186,7 +140,7 @@ gvc_channel_map_get_pa_channel_map (GvcChannelMap *map) } const pa_cvolume * -gvc_channel_map_get_cvolume (GvcChannelMap *map) +gvc_channel_map_get_cvolume (const GvcChannelMap *map) { g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL); @@ -274,7 +228,6 @@ set_from_pa_map (GvcChannelMap *map, map->priv->can_balance = pa_channel_map_can_balance (pa_map); map->priv->can_fade = pa_channel_map_can_fade (pa_map); - map->priv->has_lfe = gvc_pa_channel_map_has_position (pa_map, PA_CHANNEL_POSITION_LFE); map->priv->pa_map = *pa_map; pa_cvolume_set(&map->priv->pa_volume, pa_map->channels, PA_VOLUME_NORM); diff --git a/plugins/media-keys/cut-n-paste/gvc-channel-map.h b/plugins/media-keys/cut-n-paste/gvc-channel-map.h index be07df5..1d1ba4e 100644 --- a/plugins/media-keys/cut-n-paste/gvc-channel-map.h +++ b/plugins/media-keys/cut-n-paste/gvc-channel-map.h @@ -62,20 +62,22 @@ GType gvc_channel_map_get_type (void); GvcChannelMap * gvc_channel_map_new (void); GvcChannelMap * gvc_channel_map_new_from_pa_channel_map (const pa_channel_map *map); -guint gvc_channel_map_get_num_channels (GvcChannelMap *map); +guint gvc_channel_map_get_num_channels (const GvcChannelMap *map); const gdouble * gvc_channel_map_get_volume (GvcChannelMap *map); -gboolean gvc_channel_map_can_balance (GvcChannelMap *map); -gboolean gvc_channel_map_can_fade (GvcChannelMap *map); -gboolean gvc_channel_map_has_lfe (GvcChannelMap *map); +gboolean gvc_channel_map_can_balance (const GvcChannelMap *map); +gboolean gvc_channel_map_can_fade (const GvcChannelMap *map); +gboolean gvc_channel_map_has_position (const GvcChannelMap *map, + pa_channel_position_t position); +#define gvc_channel_map_has_lfe(x) gvc_channel_map_has_position (x, PA_CHANNEL_POSITION_LFE) void gvc_channel_map_volume_changed (GvcChannelMap *map, const pa_cvolume *cv, gboolean set); -const char * gvc_channel_map_get_mapping (GvcChannelMap *map); +const char * gvc_channel_map_get_mapping (const GvcChannelMap *map); /* private */ -const pa_cvolume * gvc_channel_map_get_cvolume (GvcChannelMap *map); -const pa_channel_map * gvc_channel_map_get_pa_channel_map (GvcChannelMap *map); +const pa_cvolume * gvc_channel_map_get_cvolume (const GvcChannelMap *map); +const pa_channel_map * gvc_channel_map_get_pa_channel_map (const GvcChannelMap *map); #ifdef __cplusplus } #endif diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-card.c b/plugins/media-keys/cut-n-paste/gvc-mixer-card.c index 25c77c0..91bdf19 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-card.c +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-card.c @@ -26,7 +26,7 @@ #include <unistd.h> #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <pulse/pulseaudio.h> @@ -47,6 +47,7 @@ struct GvcMixerCardPrivate char *target_profile; char *human_profile; GList *profiles; + pa_operation *profile_op; }; enum @@ -209,6 +210,9 @@ _pa_context_set_card_profile_by_index_cb (pa_context *cont } g_free (card->priv->target_profile); card->priv->target_profile = NULL; + + pa_operation_unref (card->priv->profile_op); + card->priv->profile_op = NULL; } gboolean @@ -223,25 +227,26 @@ gvc_mixer_card_change_profile (GvcMixerCard *card, return TRUE; if (g_strcmp0 (profile, card->priv->target_profile) == 0) return TRUE; + if (card->priv->profile_op != NULL) { + pa_operation_cancel (card->priv->profile_op); + pa_operation_unref (card->priv->profile_op); + card->priv->profile_op = NULL; + } if (card->priv->profile != NULL) { - pa_operation *o; - g_free (card->priv->target_profile); card->priv->target_profile = g_strdup (profile); - o = pa_context_set_card_profile_by_index (card->priv->pa_context, - card->priv->index, - card->priv->target_profile, - _pa_context_set_card_profile_by_index_cb, - card); + card->priv->profile_op = pa_context_set_card_profile_by_index (card->priv->pa_context, + card->priv->index, + card->priv->target_profile, + _pa_context_set_card_profile_by_index_cb, + card); - if (o == NULL) { + if (card->priv->profile_op == NULL) { g_warning ("pa_context_set_card_profile_by_index() failed"); return FALSE; } - - pa_operation_unref (o); } else { g_assert (card->priv->human_profile == NULL); card->priv->profile = g_strdup (profile); diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-card.h b/plugins/media-keys/cut-n-paste/gvc-mixer-card.h index 7a19110..54a85e2 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-card.h +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-card.h @@ -56,6 +56,7 @@ typedef struct char *human_profile; char *status; guint priority; + guint n_sinks, n_sources; } GvcMixerCardProfile; GType gvc_mixer_card_get_type (void); diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-control.c b/plugins/media-keys/cut-n-paste/gvc-mixer-control.c index 2fed2e1..7f4532c 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-control.c +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-control.c @@ -27,7 +27,7 @@ #include <unistd.h> #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <pulse/pulseaudio.h> #include <pulse/glib-mainloop.h> @@ -448,6 +448,10 @@ _set_default_source (GvcMixerControl *control, if (stream == NULL) { control->priv->default_source_id = 0; control->priv->default_source_is_set = FALSE; + g_signal_emit (control, + signals[DEFAULT_SOURCE_CHANGED], + 0, + PA_INVALID_INDEX); return; } @@ -470,8 +474,16 @@ _set_default_sink (GvcMixerControl *control, guint new_id; if (stream == NULL) { + /* Don't tell front-ends about an unset default + * sink if it's already unset */ + if (control->priv->default_sink_is_set == FALSE) + return; control->priv->default_sink_id = 0; control->priv->default_sink_is_set = FALSE; + g_signal_emit (control, + signals[DEFAULT_SINK_CHANGED], + 0, + PA_INVALID_INDEX); return; } @@ -480,7 +492,6 @@ _set_default_sink (GvcMixerControl *control, if (control->priv->default_sink_id != new_id) { control->priv->default_sink_id = new_id; control->priv->default_sink_is_set = TRUE; - g_signal_emit (control, signals[DEFAULT_SINK_CHANGED], 0, @@ -672,11 +683,13 @@ update_sink (GvcMixerControl *control, max_volume = pa_cvolume_max (&info->volume); gvc_mixer_stream_set_name (stream, info->name); + gvc_mixer_stream_set_card_index (stream, info->card); gvc_mixer_stream_set_description (stream, info->description); gvc_mixer_stream_set_icon_name (stream, "audio-card"); gvc_mixer_stream_set_volume (stream, (guint)max_volume); gvc_mixer_stream_set_is_muted (stream, info->mute); gvc_mixer_stream_set_can_decibel (stream, !!(info->flags & PA_SINK_DECIBEL_VOLUME)); + gvc_mixer_stream_set_base_volume (stream, (guint32) info->base_volume); #if PA_MICRO > 15 if (info->active_port != NULL) gvc_mixer_stream_set_port (stream, info->active_port->name); @@ -696,7 +709,7 @@ update_sink (GvcMixerControl *control, } if (map == NULL) - map = gvc_mixer_stream_get_channel_map (stream); + map = (GvcChannelMap *) gvc_mixer_stream_get_channel_map (stream); gvc_channel_map_volume_changed (map, &info->volume, FALSE); } @@ -759,6 +772,7 @@ update_source (GvcMixerControl *control, max_volume = pa_cvolume_max (&info->volume); gvc_mixer_stream_set_name (stream, info->name); + gvc_mixer_stream_set_card_index (stream, info->card); gvc_mixer_stream_set_description (stream, info->description); gvc_mixer_stream_set_icon_name (stream, "audio-input-microphone"); gvc_mixer_stream_set_volume (stream, (guint)max_volume); @@ -1064,6 +1078,8 @@ update_card (GvcMixerControl *control, profile->profile = g_strdup (pi.name); profile->human_profile = g_strdup (pi.description); profile->status = card_num_streams_to_status (pi.n_sinks, pi.n_sources); + profile->n_sinks = pi.n_sinks; + profile->n_sources = pi.n_sources; profile->priority = pi.priority; list = g_list_prepend (list, profile); } @@ -1328,6 +1344,17 @@ _pa_ext_stream_restore_read_cb (pa_context *context, if (eol > 0) { dec_outstanding (control); + /* If we don't have an event stream to restore, then + * set one up with a default 100% volume */ + if (!control->priv->event_sink_input_is_set) { + pa_ext_stream_restore_info info; + + memset (&info, 0, sizeof(info)); + info.name = "sink-input-by-media-role:event"; + info.volume.channels = 1; + info.volume.values[0] = PA_VOLUME_NORM; + update_event_role_stream (control, &info); + } return; } diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c b/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c index a2d1169..594f951 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c @@ -25,7 +25,7 @@ #include <unistd.h> #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <pulse/pulseaudio.h> #include <pulse/ext-stream-restore.h> @@ -58,7 +58,7 @@ update_settings (GvcMixerEventRole *role, { pa_operation *o; guint index; - GvcChannelMap *map; + const GvcChannelMap *map; pa_context *context; pa_ext_stream_restore_info info; @@ -87,8 +87,8 @@ update_settings (GvcMixerEventRole *role, return FALSE; } - if (op != NULL) - *op = o; + if (op != NULL) + *op = o; return TRUE; } diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c b/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c index 9dec302..1f4a06b 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c @@ -25,7 +25,7 @@ #include <unistd.h> #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <pulse/pulseaudio.h> @@ -48,12 +48,12 @@ G_DEFINE_TYPE (GvcMixerSinkInput, gvc_mixer_sink_input, GVC_TYPE_MIXER_STREAM) static gboolean gvc_mixer_sink_input_push_volume (GvcMixerStream *stream, gpointer *op) { - pa_operation *o; - guint index; - GvcChannelMap *map; - pa_context *context; - const pa_cvolume *cv; - guint num_channels; + pa_operation *o; + guint index; + const GvcChannelMap *map; + pa_context *context; + const pa_cvolume *cv; + guint num_channels; index = gvc_mixer_stream_get_index (stream); diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c b/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c index ffccc8b..3ab7924 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c @@ -25,7 +25,7 @@ #include <unistd.h> #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <pulse/pulseaudio.h> @@ -48,11 +48,11 @@ G_DEFINE_TYPE (GvcMixerSink, gvc_mixer_sink, GVC_TYPE_MIXER_STREAM) static gboolean gvc_mixer_sink_push_volume (GvcMixerStream *stream, gpointer *op) { - pa_operation *o; - guint index; - GvcChannelMap *map; - pa_context *context; - const pa_cvolume *cv; + pa_operation *o; + guint index; + const GvcChannelMap *map; + pa_context *context; + const pa_cvolume *cv; index = gvc_mixer_stream_get_index (stream); @@ -133,7 +133,7 @@ gvc_mixer_sink_change_port (GvcMixerStream *stream, return TRUE; #else - return FALSE; + return FALSE; #endif /* PA_MICRO > 15 */ } diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c b/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c index ec1efd9..7b63221 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c @@ -25,7 +25,7 @@ #include <unistd.h> #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <pulse/pulseaudio.h> diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-source.c b/plugins/media-keys/cut-n-paste/gvc-mixer-source.c index 83b8afc..bc51f08 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-source.c +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-source.c @@ -25,7 +25,7 @@ #include <unistd.h> #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <pulse/pulseaudio.h> @@ -48,11 +48,11 @@ G_DEFINE_TYPE (GvcMixerSource, gvc_mixer_source, GVC_TYPE_MIXER_STREAM) static gboolean gvc_mixer_source_push_volume (GvcMixerStream *stream, gpointer *op) { - pa_operation *o; - guint index; - GvcChannelMap *map; - pa_context *context; - const pa_cvolume *cv; + pa_operation *o; + guint index; + const GvcChannelMap *map; + pa_context *context; + const pa_cvolume *cv; index = gvc_mixer_stream_get_index (stream); @@ -133,7 +133,7 @@ gvc_mixer_source_change_port (GvcMixerStream *stream, return TRUE; #else - return FALSE; + return FALSE; #endif /* PA_MICRO > 15 */ } diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c index 7b08828..7b1e0ec 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c @@ -25,7 +25,7 @@ #include <unistd.h> #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <pulse/pulseaudio.h> @@ -40,6 +40,7 @@ struct GvcMixerStreamPrivate pa_context *pa_context; guint id; guint index; + gint card_index; GvcChannelMap *channel_map; char *name; char *description; @@ -73,6 +74,7 @@ enum PROP_CAN_DECIBEL, PROP_IS_EVENT_STREAM, PROP_IS_VIRTUAL, + PROP_CARD_INDEX, PROP_PORT, }; @@ -117,7 +119,7 @@ gvc_mixer_stream_get_id (GvcMixerStream *stream) return stream->priv->id; } -GvcChannelMap * +const GvcChannelMap * gvc_mixer_stream_get_channel_map (GvcMixerStream *stream) { g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); @@ -403,7 +405,7 @@ gvc_mixer_stream_set_base_volume (GvcMixerStream *stream, return TRUE; } -GvcMixerStreamPort * +const GvcMixerStreamPort * gvc_mixer_stream_get_port (GvcMixerStream *stream) { GList *l; @@ -489,6 +491,25 @@ gvc_mixer_stream_set_ports (GvcMixerStream *stream, return TRUE; } +gint +gvc_mixer_stream_get_card_index (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), PA_INVALID_INDEX); + return stream->priv->card_index; +} + +gboolean +gvc_mixer_stream_set_card_index (GvcMixerStream *stream, + gint card_index) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + stream->priv->card_index = card_index; + g_object_notify (G_OBJECT (stream), "card-index"); + + return TRUE; +} + static void gvc_mixer_stream_set_property (GObject *object, guint prop_id, @@ -543,6 +564,9 @@ gvc_mixer_stream_set_property (GObject *object, case PROP_PORT: gvc_mixer_stream_set_port (self, g_value_get_string (value)); break; + case PROP_CARD_INDEX: + self->priv->card_index = g_value_get_long (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -605,6 +629,9 @@ gvc_mixer_stream_get_property (GObject *object, case PROP_PORT: g_value_set_string (value, self->priv->port); break; + case PROP_CARD_INDEX: + g_value_set_long (value, self->priv->card_index); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -815,6 +842,13 @@ gvc_mixer_stream_class_init (GvcMixerStreamClass *klass) "The name of the current port for this stream", NULL, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_CARD_INDEX, + g_param_spec_long ("card-index", + "Card index", + "The index of the card for this stream", + PA_INVALID_INDEX, G_MAXLONG, PA_INVALID_INDEX, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); g_type_class_add_private (klass, sizeof (GvcMixerStreamPrivate)); } @@ -844,6 +878,9 @@ gvc_mixer_stream_finalize (GObject *object) g_return_if_fail (mixer_stream->priv != NULL); + g_object_unref (mixer_stream->priv->channel_map); + mixer_stream->priv->channel_map = NULL; + g_free (mixer_stream->priv->name); mixer_stream->priv->name = NULL; diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h index 6f7eab3..e818505 100644 --- a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h @@ -70,8 +70,8 @@ GType gvc_mixer_stream_get_type (void); pa_context * gvc_mixer_stream_get_pa_context (GvcMixerStream *stream); guint gvc_mixer_stream_get_index (GvcMixerStream *stream); guint gvc_mixer_stream_get_id (GvcMixerStream *stream); -GvcChannelMap * gvc_mixer_stream_get_channel_map (GvcMixerStream *stream); -GvcMixerStreamPort *gvc_mixer_stream_get_port (GvcMixerStream *stream); +const GvcChannelMap *gvc_mixer_stream_get_channel_map(GvcMixerStream *stream); +const GvcMixerStreamPort *gvc_mixer_stream_get_port (GvcMixerStream *stream); const GList * gvc_mixer_stream_get_ports (GvcMixerStream *stream); gboolean gvc_mixer_stream_change_port (GvcMixerStream *stream, const char *port); @@ -92,6 +92,7 @@ const char * gvc_mixer_stream_get_description (GvcMixerStream *stream); const char * gvc_mixer_stream_get_application_id (GvcMixerStream *stream); gboolean gvc_mixer_stream_is_event_stream (GvcMixerStream *stream); gboolean gvc_mixer_stream_is_virtual (GvcMixerStream *stream); +gint gvc_mixer_stream_get_card_index (GvcMixerStream *stream); /* private */ gboolean gvc_mixer_stream_set_volume (GvcMixerStream *stream, @@ -120,6 +121,8 @@ gboolean gvc_mixer_stream_set_port (GvcMixerStream *stream, const char *port); gboolean gvc_mixer_stream_set_ports (GvcMixerStream *stream, GList *ports); +gboolean gvc_mixer_stream_set_card_index (GvcMixerStream *stream, + gint card_index); #ifdef __cplusplus } diff --git a/plugins/media-keys/msd-media-keys-plugin.c b/plugins/media-keys/msd-media-keys-plugin.c index 4d297bb..93a805f 100644 --- a/plugins/media-keys/msd-media-keys-plugin.c +++ b/plugins/media-keys/msd-media-keys-plugin.c @@ -102,3 +102,9 @@ msd_media_keys_plugin_class_init (MsdMediaKeysPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdMediaKeysPluginPrivate)); } + +static void +msd_media_keys_plugin_class_finalize (MsdMediaKeysPluginClass *klass) +{ +} + diff --git a/plugins/mouse/msd-mouse-plugin.c b/plugins/mouse/msd-mouse-plugin.c index 9bd3d1b..19b96d7 100644 --- a/plugins/mouse/msd-mouse-plugin.c +++ b/plugins/mouse/msd-mouse-plugin.c @@ -102,3 +102,9 @@ msd_mouse_plugin_class_init (MsdMousePluginClass *klass) g_type_class_add_private (klass, sizeof (MsdMousePluginPrivate)); } + +static void +msd_mouse_plugin_class_finalize (MsdMousePluginClass *klass) +{ +} + diff --git a/plugins/smartcard/msd-smartcard-manager.c b/plugins/smartcard/msd-smartcard-manager.c index 8207613..503123a 100644 --- a/plugins/smartcard/msd-smartcard-manager.c +++ b/plugins/smartcard/msd-smartcard-manager.c @@ -1321,7 +1321,7 @@ on_device_removed (MsdSmartcardManager *manager, } else { g_print ("disabling manager for 2 seconds\n"); msd_smartcard_manager_stop (manager); - g_timeout_add (2000, (GSourceFunc) on_timeout, manager); + g_timeout_add_seconds (2, (GSourceFunc) on_timeout, manager); } } diff --git a/plugins/smartcard/msd-smartcard-plugin.c b/plugins/smartcard/msd-smartcard-plugin.c index 08f6e6c..ae1b264 100644 --- a/plugins/smartcard/msd-smartcard-plugin.c +++ b/plugins/smartcard/msd-smartcard-plugin.c @@ -338,3 +338,9 @@ msd_smartcard_plugin_class_init (MsdSmartcardPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdSmartcardPluginPrivate)); } + +static void +msd_smartcard_plugin_class_finalize (MsdSmartcardPluginClass *klass) +{ +} + diff --git a/plugins/sound/msd-sound-plugin.c b/plugins/sound/msd-sound-plugin.c index ac31450..f0e0a1e 100644 --- a/plugins/sound/msd-sound-plugin.c +++ b/plugins/sound/msd-sound-plugin.c @@ -98,3 +98,9 @@ msd_sound_plugin_class_init (MsdSoundPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdSoundPluginPrivate)); } + +static void +msd_sound_plugin_class_finalize (MsdSoundPluginClass *klass) +{ +} + diff --git a/plugins/typing-break/msd-typing-break-plugin.c b/plugins/typing-break/msd-typing-break-plugin.c index f0d3580..3b5770b 100644 --- a/plugins/typing-break/msd-typing-break-plugin.c +++ b/plugins/typing-break/msd-typing-break-plugin.c @@ -102,3 +102,8 @@ msd_typing_break_plugin_class_init (MsdTypingBreakPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdTypingBreakPluginPrivate)); } + +static void +msd_typing_break_plugin_class_finalize (MsdTypingBreakPluginClass *klass) +{ +} diff --git a/plugins/xrandr/msd-xrandr-plugin.c b/plugins/xrandr/msd-xrandr-plugin.c index e87baea..7680a0a 100644 --- a/plugins/xrandr/msd-xrandr-plugin.c +++ b/plugins/xrandr/msd-xrandr-plugin.c @@ -102,3 +102,9 @@ msd_xrandr_plugin_class_init (MsdXrandrPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdXrandrPluginPrivate)); } + +static void +msd_xrandr_plugin_class_finalize (MsdXrandrPluginClass *klass) +{ +} + diff --git a/plugins/xrdb/msd-xrdb-plugin.c b/plugins/xrdb/msd-xrdb-plugin.c index 1506523..6c79c57 100644 --- a/plugins/xrdb/msd-xrdb-plugin.c +++ b/plugins/xrdb/msd-xrdb-plugin.c @@ -102,3 +102,9 @@ msd_xrdb_plugin_class_init (MsdXrdbPluginClass *klass) g_type_class_add_private (klass, sizeof (MsdXrdbPluginPrivate)); } + +static void +msd_xrdb_plugin_class_finalize (MsdXrdbPluginClass *klass) +{ +} + diff --git a/plugins/xsettings/msd-xsettings-manager.c b/plugins/xsettings/msd-xsettings-manager.c index e045711..f8291f4 100644 --- a/plugins/xsettings/msd-xsettings-manager.c +++ b/plugins/xsettings/msd-xsettings-manager.c @@ -659,7 +659,7 @@ gboolean mate_xsettings_manager_start (MateXSettingsManager *manager, GError **error) { - int i; + guint i; GList *list, *l; g_debug ("Starting xsettings manager"); @@ -689,6 +689,11 @@ mate_xsettings_manager_start (MateXSettingsManager *manager, gsettings = g_hash_table_lookup (manager->priv->gsettings, translations[i].gsettings_schema); + if (gsettings == NULL) { + g_warning ("Schemas '%s' has not been setup", translations[i].gsettings_schema); + continue; + } + val = g_settings_get_value (gsettings, translations[i].gsettings_key); process_value (manager, &translations[i], val); @@ -697,7 +702,8 @@ mate_xsettings_manager_start (MateXSettingsManager *manager, list = g_hash_table_get_values (manager->priv->gsettings); for (l = list; l != NULL; l = l->next) { - g_signal_connect_object (G_OBJECT (l->data), "changed", G_CALLBACK (xsettings_callback), manager, 0); + g_signal_connect_object (G_OBJECT (l->data), "changed", + G_CALLBACK (xsettings_callback), manager, 0); } g_list_free (list); diff --git a/plugins/xsettings/msd-xsettings-plugin.c b/plugins/xsettings/msd-xsettings-plugin.c index 6449264..faa7068 100644 --- a/plugins/xsettings/msd-xsettings-plugin.c +++ b/plugins/xsettings/msd-xsettings-plugin.c @@ -102,3 +102,8 @@ mate_xsettings_plugin_class_init (MateXSettingsPluginClass *klass) g_type_class_add_private (klass, sizeof (MateXSettingsPluginPrivate)); } + +static void +mate_xsettings_plugin_class_finalize (MateXSettingsPluginClass *klass) +{ +} |