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 /plugins/keyboard | |
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
Diffstat (limited to 'plugins/keyboard')
-rw-r--r-- | plugins/keyboard/Makefile.am | 5 | ||||
-rw-r--r-- | plugins/keyboard/modmap-dialog.ui | 257 | ||||
-rw-r--r-- | plugins/keyboard/msd-keyboard-manager.c | 2 | ||||
-rw-r--r-- | plugins/keyboard/msd-keyboard-plugin.c | 6 | ||||
-rw-r--r-- | plugins/keyboard/msd-keyboard-xkb.c | 88 | ||||
-rw-r--r-- | plugins/keyboard/msd-xmodmap.c | 406 | ||||
-rw-r--r-- | plugins/keyboard/msd-xmodmap.h | 29 |
7 files changed, 6 insertions, 787 deletions
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 |