summaryrefslogtreecommitdiff
path: root/settings-dialogs
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis@xfce.org>2008-10-31 14:51:13 +0000
committerJannis Pohlmann <jannis@xfce.org>2008-10-31 14:51:13 +0000
commitb32363cfe9011a111090e1874b9e2cc956d3a836 (patch)
tree3a8c49ce10438411a3eb6e4eb246e2d39b6e97c5 /settings-dialogs
parent5a22ca3921c4e6f73a46f0090df263fdde88b72d (diff)
downloadxfwm4-b32363cfe9011a111090e1874b9e2cc956d3a836.tar.gz
Add support for keyboard shortcuts: Remove experimental shortcuts code
and add dependency on libxfce4kbd-private instead and replace MappingNotify event handler with a GdkKeymap "keys-changed" callback. Remove support for key themes. Properly stop startup notification when dialogs are plugged into xfce4-settings-manager. Update translation files. (Old svn revision: 28532)
Diffstat (limited to 'settings-dialogs')
-rw-r--r--settings-dialogs/Makefile.am10
-rw-r--r--settings-dialogs/frap-shortcuts-dialog.c499
-rw-r--r--settings-dialogs/frap-shortcuts-dialog.h52
-rw-r--r--settings-dialogs/frap-shortcuts.c140
-rw-r--r--settings-dialogs/frap-shortcuts.h34
-rw-r--r--settings-dialogs/tweaks-settings.c4
-rw-r--r--settings-dialogs/workspace-settings.c3
-rw-r--r--settings-dialogs/xfce-shortcuts-provider.c676
-rw-r--r--settings-dialogs/xfce-shortcuts-provider.h87
-rw-r--r--settings-dialogs/xfwm4-settings.c33
10 files changed, 27 insertions, 1511 deletions
diff --git a/settings-dialogs/Makefile.am b/settings-dialogs/Makefile.am
index 8e61a4872..e4c380837 100644
--- a/settings-dialogs/Makefile.am
+++ b/settings-dialogs/Makefile.am
@@ -39,13 +39,7 @@ xfwm4_workspace_settings_LDADD = \
xfwm4_settings_SOURCES = \
xfwm4-settings.c \
- xfwm4-dialog_glade.h \
- xfce-shortcuts-provider.h \
- xfce-shortcuts-provider.c \
- frap-shortcuts.h \
- frap-shortcuts.c \
- frap-shortcuts-dialog.h \
- frap-shortcuts-dialog.c
+ xfwm4-dialog_glade.h
xfwm4_settings_CFLAGS = \
$(GTK_CFLAGS) \
@@ -53,6 +47,7 @@ xfwm4_settings_CFLAGS = \
$(GLADE_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
+ $(LIBXFCE4KBD_PRIVATE_CFLAGS) \
$(LIBXFCONF_CFLAGS) \
-DDATADIR=\"$(datadir)\" \
-DSRCDIR=\"$(top_srcdir)\" \
@@ -64,6 +59,7 @@ xfwm4_settings_LDADD = \
$(GLADE_LIBS) \
$(DBUS_GLIB_LIBS) \
$(LIBXFCEGUI4_LIBS) \
+ $(LIBXFCE4KBD_PRIVATE_LIBS) \
$(LIBXFCONF_LIBS)
xfwm4_tweaks_settings_SOURCES = \
diff --git a/settings-dialogs/frap-shortcuts-dialog.c b/settings-dialogs/frap-shortcuts-dialog.c
deleted file mode 100644
index 001ca5237..000000000
--- a/settings-dialogs/frap-shortcuts-dialog.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/* vi:set expandtab sw=2 sts=2: */
-/*-
- * Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gdk/gdkkeysyms.h>
-
-#include <gtk/gtk.h>
-
-#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
-
-#include "frap-shortcuts.h"
-#include "frap-shortcuts-dialog.h"
-
-
-
-static void frap_shortcuts_dialog_class_init (FrapShortcutsDialogClass *klass);
-static void frap_shortcuts_dialog_init (FrapShortcutsDialog *dialog);
-static void frap_shortcuts_dialog_dispose (GObject *object);
-static void frap_shortcuts_dialog_finalize (GObject *object);
-static void frap_shortcuts_dialog_create_contents (FrapShortcutsDialog *dialog,
- const gchar *provider,
- const gchar *action_name,
- const gchar *action);
-static gboolean frap_shortcuts_dialog_key_pressed (FrapShortcutsDialog *dialog,
- GdkEventKey *event);
-static gboolean frap_shortcuts_dialog_key_released (FrapShortcutsDialog *dialog,
- GdkEventKey *event);
-static gchar *frap_shortcuts_dialog_shortcut_name (FrapShortcutsDialog *dialog,
- guint keyval,
- guint modifiers);
-
-
-
-struct _FrapShortcutsDialogClass
-{
- XfceTitledDialogClass __parent__;
-
- gboolean (*validate_shortcut) (FrapShortcutsDialog *dialog,
- const gchar *shortcut,
- gpointer user_data);
-
- gint validate_shortcut_signal;
-};
-
-struct _FrapShortcutsDialog
-{
- XfceTitledDialog __parent__;
-
- GtkWidget *shortcut_label;
-
- gchar *action_name;
- gchar *action;
- gchar *shortcut;
-};
-
-
-
-static GObjectClass *frap_shortcuts_dialog_parent_class = NULL;
-
-
-
-GType
-frap_shortcuts_dialog_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (FrapShortcutsDialogClass),
- NULL,
- NULL,
- (GClassInitFunc) frap_shortcuts_dialog_class_init,
- NULL,
- NULL,
- sizeof (FrapShortcutsDialog),
- 0,
- (GInstanceInitFunc) frap_shortcuts_dialog_init,
- NULL,
- };
-
- type = g_type_register_static (XFCE_TYPE_TITLED_DIALOG, "FrapShortcutsDialog", &info, 0);
- }
-
- return type;
-}
-
-
-
-/**
- * Taken from GTK+ (_gtk_marshal_BOOLEAN__SRING). Credits go out to the
- * GTK+ devs for this.
- */
-void
-marshal_BOOLEAN__STRING (GClosure *closure,
- GValue *return_value G_GNUC_UNUSED,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint G_GNUC_UNUSED,
- gpointer marshal_data)
-{
- typedef gboolean (*GMarshalFunc_BOOLEAN__STRING) (gpointer data1,
- gpointer arg_1,
- gpointer data2);
- register GMarshalFunc_BOOLEAN__STRING callback;
- register GCClosure *cc = (GCClosure*) closure;
- register gpointer data1, data2;
- gboolean v_return;
-
- g_return_if_fail (return_value != NULL);
- g_return_if_fail (n_param_values == 2);
-
- if (G_CCLOSURE_SWAP_DATA (closure))
- {
- data1 = closure->data;
- data2 = g_value_peek_pointer (param_values + 0);
- }
- else
- {
- data1 = g_value_peek_pointer (param_values + 0);
- data2 = closure->data;
- }
-
- callback = (GMarshalFunc_BOOLEAN__STRING) (marshal_data ? marshal_data : cc->callback);
-
- #define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
- v_return = callback (data1, g_marshal_value_peek_string (param_values + 1), data2);
-
- g_value_set_boolean (return_value, v_return);
-}
-
-
-
-
-static void
-frap_shortcuts_dialog_class_init (FrapShortcutsDialogClass *klass)
-{
- GObjectClass *gobject_class;
-
- /* Determine parent type class */
- frap_shortcuts_dialog_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->dispose = frap_shortcuts_dialog_dispose;
- gobject_class->finalize = frap_shortcuts_dialog_finalize;
-
- klass->validate_shortcut = NULL;
-
- /* Create 'validate-shortcut' signal */
- klass->validate_shortcut_signal = g_signal_new ("validate-shortcut",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (FrapShortcutsDialogClass, validate_shortcut),
- NULL,
- NULL,
- marshal_BOOLEAN__STRING,
- G_TYPE_BOOLEAN,
- 1,
- G_TYPE_STRING);
-}
-
-
-
-static void
-frap_shortcuts_dialog_init (FrapShortcutsDialog *dialog)
-{
- dialog->shortcut = NULL;
-}
-
-
-
-static void
-frap_shortcuts_dialog_dispose (GObject *object)
-{
- (*G_OBJECT_CLASS (frap_shortcuts_dialog_parent_class)->dispose) (object);
-}
-
-
-
-static void
-frap_shortcuts_dialog_finalize (GObject *object)
-{
- FrapShortcutsDialog *dialog = FRAP_SHORTCUTS_DIALOG (object);
-
- g_free (dialog->action_name);
- g_free (dialog->action);
- g_free (dialog->shortcut);
-
- (*G_OBJECT_CLASS (frap_shortcuts_dialog_parent_class)->finalize) (object);
-}
-
-
-
-GtkWidget*
-frap_shortcuts_dialog_new (const gchar *provider,
- const gchar *action_name,
- const gchar *action)
-{
- FrapShortcutsDialog *dialog;
-
- dialog = g_object_new (FRAP_TYPE_SHORTCUTS_DIALOG, NULL);
- dialog->action_name = g_strdup (action_name);
- dialog->action = g_strdup (action);
-
- frap_shortcuts_dialog_create_contents (dialog, provider, action_name, action);
-
- return GTK_WIDGET (dialog);
-}
-
-
-
-static void
-frap_shortcuts_dialog_create_contents (FrapShortcutsDialog *dialog,
- const gchar *provider,
- const gchar *action_name,
- const gchar *action)
-{
- GtkWidget *button;
- GtkWidget *hbox;
- GtkWidget *label;
- const gchar *title;
- gchar *subtitle;
-
- if (g_utf8_collate (provider, "xfwm4") == 0)
- {
- title = _("Enter window manager action shortcut");
- subtitle = g_strdup_printf (_("Action: %s"), action_name);
- }
- else if (g_utf8_collate (provider, "commands") == 0)
- {
- title = _("Enter command shortcut");
- subtitle = g_strdup_printf (_("Command: %s"), action_name);
- }
- else
- {
- title = _("Enter shortcut");
- subtitle = g_strdup_printf (_("Action: %s"), action_name);
- }
-
- /* Set dialog title */
- gtk_window_set_title (GTK_WINDOW (dialog), title);
- gtk_window_set_icon_name (GTK_WINDOW (dialog), "input-keyboard");
- xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), subtitle);
- g_free (subtitle);
-
- /* Configure dialog */
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-
- /* Create clear button for xfwm4 */
- if (g_utf8_collate (provider, "xfwm4") == 0)
- {
- button = gtk_button_new_from_stock (GTK_STOCK_CLEAR);
- gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_REJECT);
- gtk_widget_show (button);
- }
-
- /* Create cancel button */
- button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CANCEL);
- gtk_widget_show (button);
-
- hbox = gtk_hbox_new (FALSE, 12);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
- gtk_widget_show (hbox);
-
- label = gtk_label_new (_("Shortcut:"));
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
-
- dialog->shortcut_label = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (dialog->shortcut_label), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (hbox), dialog->shortcut_label, TRUE, TRUE, 0);
- gtk_widget_show (dialog->shortcut_label);
-
- /* Connect to key release signal for determining the new shortcut */
- g_signal_connect_swapped (dialog, "key-press-event", G_CALLBACK (frap_shortcuts_dialog_key_pressed), dialog);
- g_signal_connect_swapped (dialog, "key-release-event", G_CALLBACK (frap_shortcuts_dialog_key_released), dialog);
-}
-
-
-
-gint
-frap_shortcuts_dialog_run (FrapShortcutsDialog *dialog)
-{
- gint response = GTK_RESPONSE_CANCEL;
-
- g_return_val_if_fail (FRAP_IS_SHORTCUTS_DIALOG (dialog), GTK_RESPONSE_CANCEL);
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (dialog))));
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
-
- /* Take control on the keyboard */
- if (G_LIKELY (gdk_keyboard_grab (gtk_widget_get_root_window (GTK_WIDGET (dialog)), TRUE, GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS))
- {
- /* Run the dialog and wait for the user to enter a valid shortcut */
- response = gtk_dialog_run (GTK_DIALOG (dialog));
-
- /* Clear shortcut if requested by the user */
- if (G_UNLIKELY (response == GTK_RESPONSE_NO))
- {
- g_free (dialog->shortcut);
- dialog->shortcut = g_strdup ("");
- }
-
- /* Release keyboard */
- gdk_keyboard_ungrab (GDK_CURRENT_TIME);
- }
- else
- g_warning ("%s", _("Could not grab the keyboard."));
-
- /* Return the response ID */
- return response;
-}
-
-
-
-static gboolean
-frap_shortcuts_dialog_key_pressed (FrapShortcutsDialog *dialog,
- GdkEventKey *event)
-{
- gchar *text;
- gchar *shortcut;
-
- g_free (dialog->shortcut);
-
- /* Determine and remember the current shortcut */
- dialog->shortcut = frap_shortcuts_dialog_shortcut_name (dialog, event->keyval, event->state);
-
- shortcut = g_markup_escape_text (dialog->shortcut, -1);
- text = g_strdup_printf (_("<span size='large'><b>%s</b></span>"), shortcut);
-
- gtk_label_set_markup (GTK_LABEL (dialog->shortcut_label), text);
-
- g_free (text);
- g_free (shortcut);
-
- return FALSE;
-}
-
-
-
-static gboolean
-frap_shortcuts_dialog_key_released (FrapShortcutsDialog *dialog,
- GdkEventKey *event)
-{
- gboolean shortcut_accepted = FALSE;
-
- /* Let 'validate-shortcut' listeners decide whether this shortcut is ok or not */
- g_signal_emit_by_name (dialog, "validate-shortcut", dialog->shortcut, &shortcut_accepted);
-
- /* Check if the shortcut was accepted */
- if (G_LIKELY (shortcut_accepted))
- {
- /* Release keyboard */
- gdk_keyboard_ungrab (GDK_CURRENT_TIME);
-
- /* Exit dialog with positive response */
- gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- }
- else
- {
- /* Clear label */
- gtk_label_set_markup (GTK_LABEL (dialog->shortcut_label), "");
- }
-
- return FALSE;
-}
-
-
-
-static gchar *
-frap_shortcuts_dialog_shortcut_name (FrapShortcutsDialog *dialog,
- guint keyval,
- guint modifiers)
-{
- XModifierKeymap *modmap;
- Display *display;
- const KeySym *keysyms;
- KeyCode keycode;
- KeySym *keymap;
- gint keysyms_per_keycode = 0;
- gint min_keycode = 0;
- gint max_keycode = 0;
- gint mask;
- gint i;
- gint j;
-
- g_return_val_if_fail (FRAP_IS_SHORTCUTS_DIALOG (dialog), NULL);
-
- display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
-
- gdk_error_trap_push ();
-
- XDisplayKeycodes (display, &min_keycode, &max_keycode);
-
- keymap = XGetKeyboardMapping (display, min_keycode, max_keycode - min_keycode + 1, &keysyms_per_keycode);
-
- if (G_LIKELY (keymap != NULL))
- {
- modmap = XGetModifierMapping (display);
-
- if (G_LIKELY (modmap != NULL))
- {
- for (i = 0; i < 8 * modmap->max_keypermod; ++i)
- {
- keycode = modmap->modifiermap[i];
-
- if (keycode == 0 || keycode < min_keycode || keycode > max_keycode)
- continue;
-
- keysyms = keymap + (keycode - min_keycode) * keysyms_per_keycode;
- mask = 1 << (i / modmap->max_keypermod);
-
- for (j = 0; j < keysyms_per_keycode; ++j)
- {
- if (keysyms[j] == GDK_Super_L || keysyms[j] == GDK_Super_R)
- modifiers &= ~mask;
-
-#if 0
- if (keysyms[j] == GDK_Meta_L || keysyms[j] == GDK_Meta_R)
- modifiers &= ~mask;
-#endif
-
- if (keysyms[j] == GDK_Hyper_L || keysyms[j] == GDK_Hyper_R)
- modifiers &= ~mask;
-
- if (keysyms[j] == GDK_Scroll_Lock)
- modifiers &= ~mask;
-
- if (keysyms[j] == GDK_Num_Lock)
- modifiers &= ~mask;
-
- if (keysyms[j] == GDK_Caps_Lock)
- modifiers &= ~mask;
- }
- }
-
- XFreeModifiermap (modmap);
- }
-
- XFree (keymap);
- }
-
- gdk_flush ();
- gdk_error_trap_pop ();
-
- return gtk_accelerator_name (keyval, modifiers);
-}
-
-
-
-const gchar*
-frap_shortcuts_dialog_get_shortcut (FrapShortcutsDialog *dialog)
-{
- g_return_val_if_fail (FRAP_IS_SHORTCUTS_DIALOG (dialog), NULL);
- return dialog->shortcut;
-}
-
-
-
-const gchar *
-frap_shortcuts_dialog_get_action (FrapShortcutsDialog *dialog)
-{
- g_return_val_if_fail (FRAP_IS_SHORTCUTS_DIALOG (dialog), NULL);
- return dialog->action;
-}
-
-
-
-const gchar *
-frap_shortcuts_dialog_get_action_name (FrapShortcutsDialog *dialog)
-{
- g_return_val_if_fail (FRAP_IS_SHORTCUTS_DIALOG (dialog), NULL);
- return dialog->action_name;
-}
diff --git a/settings-dialogs/frap-shortcuts-dialog.h b/settings-dialogs/frap-shortcuts-dialog.h
deleted file mode 100644
index 4cee40fda..000000000
--- a/settings-dialogs/frap-shortcuts-dialog.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* vi:set expandtab sw=2 sts=2: */
-/*-
- * Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __FRAP_SHORTCUTS_DIALOG_H__
-#define __FRAP_SHORTCUTS_DIALOG_H__
-
-#include <gtk/gtk.h>
-
-#include "frap-shortcuts.h"
-
-G_BEGIN_DECLS;
-
-typedef struct _FrapShortcutsDialogClass FrapShortcutsDialogClass;
-typedef struct _FrapShortcutsDialog FrapShortcutsDialog;
-
-#define FRAP_TYPE_SHORTCUTS_DIALOG (frap_shortcuts_dialog_get_type ())
-#define FRAP_SHORTCUTS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FRAP_TYPE_SHORTCUTS_DIALOG, FrapShortcutsDialog))
-#define FRAP_SHORTCUTS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FRAP_TYPE_SHORTCUTS_DIALOG, FrapShortcutsDialogClass))
-#define FRAP_IS_SHORTCUTS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FRAP_TYPE_SHORTCUTS_DIALOG))
-#define FRAP_IS_SHORTCUTS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FRAP_TYPE_SHORTCUTS_DIALOG))
-#define FRAP_SHORTCUTS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FRAP_TYPE_SHORTCUTS_DIALOG, FrapShortcutsDialogClass))
-
-GType frap_shortcuts_dialog_get_type (void) G_GNUC_CONST;
-
-GtkWidget *frap_shortcuts_dialog_new (const gchar *provider,
- const gchar *action_name,
- const gchar *action);
-gint frap_shortcuts_dialog_run (FrapShortcutsDialog *dialog);
-const gchar *frap_shortcuts_dialog_get_shortcut (FrapShortcutsDialog *dialog);
-const gchar *frap_shortcuts_dialog_get_action (FrapShortcutsDialog *action);
-const gchar *frap_shortcuts_dialog_get_action_name (FrapShortcutsDialog *action);
-
-G_END_DECLS;
-
-#endif /* !__FRAP_SHORTCUTS_DIALOG_H__ */
diff --git a/settings-dialogs/frap-shortcuts.c b/settings-dialogs/frap-shortcuts.c
deleted file mode 100644
index 8cbc93f9e..000000000
--- a/settings-dialogs/frap-shortcuts.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* vi:set expandtab sw=2 sts=2: */
-/*-
- * Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-
-#include <X11/Xlib.h>
-
-#include <gtk/gtk.h>
-
-#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
-
-#include <xfconf/xfconf.h>
-
-#include "frap-shortcuts.h"
-
-
-
-typedef struct
-{
- const gchar *owner_name;
- const gchar *other_name;
- const gchar *message;
- const gchar *owner_button_text;
- const gchar *other_button_text;
-} FrapShortcutsConflictMessage;
-
-
-
-static FrapShortcutsConflictMessage conflict_messages[] = {
- { "xfwm4", "xfwm4",
- N_("This shortcut is already being used by <b>another window manager action</b>. Which action do you want to use?"),
- N_("Use %s"), N_("Keep the other one") },
- { "xfwm4", "commands",
- N_("The shortcut is already being used for the command <b>%s</b>. Which action do you want to use?"),
- N_("Use %s"), N_("Keep %s") },
- { "commands","commands",
- N_("The shortcut is already being used for the command <b>%s</b>. Which action do you want to use?"),
- N_("Use %s"), N_("Keep %s") },
- { "commands", "xfwm4",
- N_("The shortcut is already being used by a <b>window manager action</b>. Which action do you want to use?"),
- N_("Use %s"), N_("Keep the window manager action") },
- { 0, 0, NULL, NULL, NULL },
-};
-
-
-
-gint
-frap_shortcuts_conflict_dialog (const gchar *owner,
- const gchar *other,
- const gchar *shortcut,
- const gchar *owner_action,
- const gchar *other_action,
- gboolean ignore_same_provider)
-{
- gchar *title;
- gchar *primary_text;
- gchar *secondary_text;
- gchar *owner_action_name;
- gchar *other_action_name;
- gchar *owner_button_text;
- gchar *other_button_text;
- gchar *escaped_shortcut;
- gboolean handled = FALSE;
- gint response = GTK_RESPONSE_ACCEPT;
- gint i;
-
- if (g_utf8_collate (owner, other) == 0 && ignore_same_provider)
- return GTK_RESPONSE_ACCEPT;
-
- if (g_utf8_collate (owner, other) == 0 && g_utf8_collate (owner_action, other_action) == 0)
- return GTK_RESPONSE_ACCEPT;
-
- title = g_strdup_printf (_("Conflicting actions for %s"), shortcut);
-
- for (i = 0; conflict_messages[i].message != NULL; ++i)
- if (g_utf8_collate (conflict_messages[i].owner_name, owner) == 0 &&
- g_utf8_collate (conflict_messages[i].other_name, other) == 0)
- {
- escaped_shortcut = g_markup_escape_text (shortcut, -1);
- primary_text = g_strdup_printf (_("Conflicting actions for %s"), escaped_shortcut);
- g_free (escaped_shortcut);
-
- owner_action_name = owner_action == NULL ? NULL : g_markup_escape_text (owner_action, -1);
- other_action_name = other_action == NULL ? NULL : g_markup_escape_text (other_action, -1);
-
- secondary_text = g_strdup_printf (conflict_messages[i].message, other_action_name);
-
- owner_button_text = g_markup_printf_escaped (conflict_messages[i].owner_button_text, owner_action_name);
- other_button_text = g_markup_printf_escaped (conflict_messages[i].other_button_text, other_action_name);
-
- response = xfce_message_dialog (NULL, title, GTK_STOCK_DIALOG_QUESTION,
- primary_text, secondary_text,
- XFCE_CUSTOM_BUTTON, owner_button_text, GTK_RESPONSE_ACCEPT,
- XFCE_CUSTOM_BUTTON, other_button_text, GTK_RESPONSE_REJECT,
- NULL);
-
- g_free (other_button_text);
- g_free (owner_button_text);
- g_free (secondary_text);
- g_free (other_action_name);
- g_free (owner_action_name);
- g_free (primary_text);
- g_free (title);
-
- handled = TRUE;
- break;
- }
-
- if (G_UNLIKELY (!handled))
- {
- xfce_message_dialog (NULL, title, GTK_STOCK_DIALOG_ERROR,
- primary_text, _("The shortcut is already being used for something else."),
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
- response = GTK_RESPONSE_REJECT;
- }
-
- return response;
-}
diff --git a/settings-dialogs/frap-shortcuts.h b/settings-dialogs/frap-shortcuts.h
deleted file mode 100644
index 9a6b93623..000000000
--- a/settings-dialogs/frap-shortcuts.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* vi:set expandtab sw=2 sts=2: */
-/*-
- * Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __FRAP_SHORTCUTS_H__
-#define __FRAP_SHORTCUTS_H__
-
-#include <X11/Xlib.h>
-#include <xfconf/xfconf.h>
-
-gboolean frap_shortcuts_conflict_dialog (const gchar *owner,
- const gchar *other,
- const gchar *shortcut,
- const gchar *owner_action,
- const gchar *other_action,
- gboolean ignore_same_provider);
-
-#endif /* !__FRAP_SHORTCUTS_H__ */
diff --git a/settings-dialogs/tweaks-settings.c b/settings-dialogs/tweaks-settings.c
index 66d9e54ce..bec7d6cbd 100644
--- a/settings-dialogs/tweaks-settings.c
+++ b/settings-dialogs/tweaks-settings.c
@@ -447,6 +447,7 @@ main (int argc, gchar **argv)
{
/* Create plug widget */
plug = gtk_plug_new (opt_socket_id);
+ g_signal_connect (plug, "delete-event", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (plug);
/* Get plug child widget */
@@ -454,6 +455,9 @@ main (int argc, gchar **argv)
gtk_widget_reparent (plug_child, plug);
gtk_widget_show (plug_child);
+ /* Stop startup notification */
+ gdk_notify_startup_complete ();
+
/* Enter main loop */
gtk_main ();
}
diff --git a/settings-dialogs/workspace-settings.c b/settings-dialogs/workspace-settings.c
index 2cdde7733..9e5d4eab2 100644
--- a/settings-dialogs/workspace-settings.c
+++ b/settings-dialogs/workspace-settings.c
@@ -434,6 +434,9 @@ main(int argc, gchar **argv)
gtk_widget_reparent (plug_child, plug);
gtk_widget_show (plug_child);
+ /* Stop startup notification */
+ gdk_notify_startup_complete ();
+
/* Enter main loop */
gtk_main ();
}
diff --git a/settings-dialogs/xfce-shortcuts-provider.c b/settings-dialogs/xfce-shortcuts-provider.c
deleted file mode 100644
index 97ff14e82..000000000
--- a/settings-dialogs/xfce-shortcuts-provider.c
+++ /dev/null
@@ -1,676 +0,0 @@
-/* vi:set sw=2 sts=2 ts=2 et ai: */
-/*-
- * Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>.
- *
- * 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., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <libxfce4util/libxfce4util.h>
-#include <xfconf/xfconf.h>
-
-#include "xfce-shortcuts-provider.h"
-
-
-
-#define XFCE_SHORTCUTS_PROVIDER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFCE_TYPE_SHORTCUTS_PROVIDER, XfceShortcutsProviderPrivate))
-
-
-
-/* Property identifiers */
-enum
-{
- PROP_0,
- PROP_NAME,
-};
-
-
-
-typedef struct _XfceShortcutsProviderContext XfceShortcutsProviderContext;
-
-
-
-static void xfce_shortcuts_provider_class_init (XfceShortcutsProviderClass *klass);
-static void xfce_shortcuts_provider_init (XfceShortcutsProvider *provider);
-static void xfce_shortcuts_provider_constructed (GObject *object);
-static void xfce_shortcuts_provider_finalize (GObject *object);
-static void xfce_shortcuts_provider_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void xfce_shortcuts_provider_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void xfce_shortcuts_provider_register (XfceShortcutsProvider *provider);
-static void xfce_shortcuts_provider_property_changed (XfconfChannel *channel,
- gchar *property,
- GValue *value,
- XfceShortcutsProvider *provider);
-
-
-
-struct _XfceShortcutsProviderPrivate
-{
- XfconfChannel *channel;
- gchar *name;
- gchar *default_base_property;
- gchar *custom_base_property;
-};
-
-struct _XfceShortcutsProviderContext
-{
- XfceShortcutsProvider *provider;
- GList *list;
- const gchar *base_property;
-};
-
-
-
-static GObjectClass *xfce_shortcuts_provider_parent_class = NULL;
-
-
-
-GType
-xfce_shortcuts_provider_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceShortcutsProviderClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_shortcuts_provider_class_init,
- NULL,
- NULL,
- sizeof (XfceShortcutsProvider),
- 0,
- (GInstanceInitFunc) xfce_shortcuts_provider_init,
- NULL,
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "XfceShortcutsProvider", &info, 0);
- }
-
- return type;
-}
-
-
-
-static void
-xfce_shortcuts_provider_class_init (XfceShortcutsProviderClass *klass)
-{
- GObjectClass *gobject_class;
-
- g_type_class_add_private (klass, sizeof (XfceShortcutsProviderPrivate));
-
- /* Determine the parent type class */
- xfce_shortcuts_provider_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class = G_OBJECT_CLASS (klass);
-#if GLIB_CHECK_VERSION (2,14,0)
- gobject_class->constructed = xfce_shortcuts_provider_constructed;
-#endif
- gobject_class->finalize = xfce_shortcuts_provider_finalize;
- gobject_class->get_property = xfce_shortcuts_provider_get_property;
- gobject_class->set_property = xfce_shortcuts_provider_set_property;
-
- g_object_class_install_property (gobject_class,
- PROP_NAME,
- g_param_spec_string ("name",
- "name",
- "name",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
- g_signal_new ("shortcut-removed",
- XFCE_TYPE_SHORTCUTS_PROVIDER,
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- 0,
- NULL,
- NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE,
- 1,
- G_TYPE_STRING);
-
- g_signal_new ("shortcut-added",
- XFCE_TYPE_SHORTCUTS_PROVIDER,
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- 0,
- NULL,
- NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE,
- 1,
- G_TYPE_STRING);
-}
-
-
-
-static void
-xfce_shortcuts_provider_init (XfceShortcutsProvider *provider)
-{
- provider->priv = XFCE_SHORTCUTS_PROVIDER_GET_PRIVATE (provider);
-
- provider->priv->channel = xfconf_channel_new ("xfce4-keyboard-shortcuts");
-
- g_signal_connect (provider->priv->channel, "property-changed",
- G_CALLBACK (xfce_shortcuts_provider_property_changed), provider);
-}
-
-
-
-static void
-xfce_shortcuts_provider_constructed (GObject *object)
-{
- XfceShortcutsProvider *provider = XFCE_SHORTCUTS_PROVIDER (object);
-
- xfce_shortcuts_provider_register (provider);
-
- provider->priv->default_base_property = g_strdup_printf ("/%s/default", provider->priv->name);
- provider->priv->custom_base_property = g_strdup_printf ("/%s/custom", provider->priv->name);
-
- if (!xfce_shortcuts_provider_is_custom (provider))
- xfce_shortcuts_provider_reset_to_defaults (provider);
-}
-
-
-
-static void
-xfce_shortcuts_provider_finalize (GObject *object)
-{
- XfceShortcutsProvider *provider = XFCE_SHORTCUTS_PROVIDER (object);
-
- g_free (provider->priv->name);
- g_free (provider->priv->custom_base_property);
- g_free (provider->priv->default_base_property);
-
- g_object_unref (provider->priv->channel);
-
- (*G_OBJECT_CLASS (xfce_shortcuts_provider_parent_class)->finalize) (object);
-}
-
-
-
-static void
-xfce_shortcuts_provider_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- XfceShortcutsProvider *provider = XFCE_SHORTCUTS_PROVIDER (object);
-
- switch (prop_id)
- {
- case PROP_NAME:
- g_value_set_string (value, provider->priv->name);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-
-static void
-xfce_shortcuts_provider_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- XfceShortcutsProvider *provider = XFCE_SHORTCUTS_PROVIDER (object);
-
- switch (prop_id)
- {
- case PROP_NAME:
- g_free (provider->priv->name);
- provider->priv->name = g_strdup (g_value_get_string (value));
- g_object_notify (object, "name");
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-
-static void
-xfce_shortcuts_provider_register (XfceShortcutsProvider *provider)
-{
- gchar **provider_names;
- const gchar **names;
- gboolean already_registered = FALSE;
- gint length;
- gint i;
-
- g_return_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider));
-
- provider_names = xfconf_channel_get_string_list (provider->priv->channel, "/providers");
-
- for (i = 0; provider_names != NULL && provider_names[i] != NULL; ++i)
- if (G_UNLIKELY (g_str_equal (provider_names[i], xfce_shortcuts_provider_get_name (provider))))
- {
- already_registered = TRUE;
- break;
- }
-
- length = i;
-
- if (G_UNLIKELY (!already_registered))
- {
- names = g_new0 (const gchar *, length + 1);
- for (i = 0; provider_names != NULL && provider_names[i] != NULL; ++i)
- names[i] = provider_names[i];
- names[i++] = xfce_shortcuts_provider_get_name (provider);
- names[i] = NULL;
-
- xfconf_channel_set_string_list (provider->priv->channel, "/providers", names);
-
- g_free (names);
- }
-
- g_strfreev (provider_names);
-}
-
-
-
-static void
-xfce_shortcuts_provider_property_changed (XfconfChannel *channel,
- gchar *property,
- GValue *value,
- XfceShortcutsProvider *provider)
-{
- const gchar *shortcut;
- gchar *override_property;
-
- g_return_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider));
-
- DBG ("property = %s", property);
-
- if (!g_str_has_prefix (property, provider->priv->custom_base_property))
- return;
-
- override_property = g_strconcat (provider->priv->custom_base_property, "/override", NULL);
-
- if (G_UNLIKELY (g_utf8_collate (property, override_property) == 0))
- {
- g_free (override_property);
- return;
- }
- g_free (override_property);
-
- shortcut = property + strlen (provider->priv->custom_base_property) + strlen ("/");
-
- if (G_VALUE_TYPE (value) != G_TYPE_INVALID)
- g_signal_emit_by_name (provider, "shortcut-added", shortcut);
- else
- g_signal_emit_by_name (provider, "shortcut-removed", shortcut);
-}
-
-
-
-XfceShortcutsProvider *
-xfce_shortcuts_provider_new (const gchar *name)
-{
- GObject *object = g_object_new (XFCE_TYPE_SHORTCUTS_PROVIDER, "name", name, NULL);
-
-#if !GLIB_CHECK_VERSION (2,14,0)
- xfce_shortcuts_provider_constructed (object);
-#endif
-
- return XFCE_SHORTCUTS_PROVIDER (object);
-}
-
-
-
-GList *
-xfce_shortcuts_provider_get_providers (void)
-{
- GList *providers = NULL;
- XfconfChannel *channel;
- gchar **names;
- gint i;
-
- channel = xfconf_channel_get ("xfce4-keyboard-shortcuts");
- names = xfconf_channel_get_string_list (channel, "/providers");
-
- if (G_LIKELY (names != NULL))
- {
- for (i = 0; names[i] != NULL; ++i)
- providers = g_list_append (providers, xfce_shortcuts_provider_new (names[i]));
- g_strfreev (names);
- }
-
- return providers;
-}
-
-
-
-void
-xfce_shortcuts_provider_free_providers (GList *providers)
-{
- GList *iter;
-
- for (iter = g_list_first (providers); iter != NULL; iter = g_list_next (iter))
- g_object_unref (iter->data);
-
- g_list_free (providers);
-}
-
-
-
-const gchar *
-xfce_shortcuts_provider_get_name (XfceShortcutsProvider *provider)
-{
- g_return_val_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider), NULL);
- return provider->priv->name;
-}
-
-
-
-gboolean
-xfce_shortcuts_provider_is_custom (XfceShortcutsProvider *provider)
-{
- gchar *property;
- gboolean override;
-
- g_return_val_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider), FALSE);
- g_return_val_if_fail (XFCONF_IS_CHANNEL (provider->priv->channel), FALSE);
-
- property = g_strconcat (provider->priv->custom_base_property, "/override", NULL);
- override = xfconf_channel_get_bool (provider->priv->channel, property, FALSE);
- g_free (property);
-
- return override;
-}
-
-
-
-void
-xfce_shortcuts_provider_reset_to_defaults (XfceShortcutsProvider *provider)
-{
- g_return_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider));
- g_return_if_fail (XFCONF_IS_CHANNEL (provider->priv->channel));
-
- DBG ("property = %s", provider->priv->custom_base_property);
-
- xfconf_channel_reset_property (provider->priv->channel, provider->priv->custom_base_property, TRUE);
- xfce_shortcuts_provider_clone_defaults (provider);
-}
-
-
-
-static gboolean
-_xfce_shortcuts_provider_clone_default (const gchar *property,
- const GValue *value,
- XfceShortcutsProvider *provider)
-{
- const gchar *shortcut;
- const gchar *command;
- gchar *custom_property;
-
- g_return_val_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider), TRUE);
- g_return_val_if_fail (XFCONF_IS_CHANNEL (provider->priv->channel), TRUE);
-
- if (G_UNLIKELY (!G_IS_VALUE (value) || G_VALUE_TYPE (value) != G_TYPE_STRING))
- return FALSE;
-
- shortcut = property + strlen (provider->priv->default_base_property) + strlen ("/");
- command = g_value_get_string (value);
-
- DBG ("shortcut = %s, command = %s", shortcut, command);
-
- custom_property = g_strconcat (provider->priv->custom_base_property, "/", shortcut, NULL);
- xfconf_channel_set_string (provider->priv->channel, custom_property, command);
- g_free (custom_property);
-
- return FALSE;
-}
-
-
-
-void
-xfce_shortcuts_provider_clone_defaults (XfceShortcutsProvider *provider)
-{
- GHashTable *properties;
- gchar *property;
-
- g_return_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider));
- g_return_if_fail (XFCONF_IS_CHANNEL (provider->priv->channel));
-
- /* Get default command shortcuts */
- properties = xfconf_channel_get_properties (provider->priv->channel, provider->priv->default_base_property);
-
- if (G_LIKELY (properties != NULL))
- {
- /* Copy from /commands/default to /commands/custom property by property */
- g_hash_table_foreach (properties, (GHFunc) _xfce_shortcuts_provider_clone_default, provider);
-
- g_hash_table_destroy (properties);
- }
-
- DBG ("adding override property");
-
- /* Add the override property */
- property = g_strconcat (provider->priv->custom_base_property, "/override", NULL);
- xfconf_channel_set_bool (provider->priv->channel, property, TRUE);
- g_free (property);
-}
-
-
-
-static gboolean
-_xfce_shortcuts_provider_get_shortcut (const gchar *property,
- const GValue *value,
- XfceShortcutsProviderContext *context)
-{
- XfceShortcut *sc;
- const gchar *shortcut;
- const gchar *command;
-
- g_return_val_if_fail (context != NULL, TRUE);
- g_return_val_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (context->provider), TRUE);
-
- if (G_VALUE_TYPE (value) != G_TYPE_STRING)
- return FALSE;
-
- if (!g_str_has_prefix (property, context->provider->priv->custom_base_property))
- return FALSE;
-
- shortcut = property + strlen (context->provider->priv->custom_base_property) + strlen ("/");
- command = g_value_get_string (value);
-
- if (G_LIKELY (shortcut != NULL && command != NULL && g_utf8_strlen (shortcut, -1) > 0 && g_utf8_strlen (command, -1) > 0))
- {
- sc = g_new0 (XfceShortcut, 1);
-
- sc->property_name = g_strdup (property);
- sc->shortcut = g_strdup (shortcut);
- sc->command = g_strdup (command);
-
- context->list = g_list_append (context->list, sc);
- }
-
- return FALSE;
-}
-
-
-
-GList *
-xfce_shortcuts_provider_get_shortcuts (XfceShortcutsProvider *provider)
-{
- XfceShortcutsProviderContext context;
- GHashTable *properties;
-
- g_return_val_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider), NULL);
- g_return_val_if_fail (XFCONF_IS_CHANNEL (provider->priv->channel), NULL);
-
- properties = xfconf_channel_get_properties (provider->priv->channel, provider->priv->custom_base_property);
-
- context.provider = provider;
- context.list = NULL;
-
- if (G_LIKELY (properties != NULL))
- g_hash_table_foreach (properties, (GHFunc) _xfce_shortcuts_provider_get_shortcut, &context);
-
- return context.list;
-}
-
-
-
-XfceShortcut *
-xfce_shortcuts_provider_get_shortcut (XfceShortcutsProvider *provider,
- const gchar *shortcut)
-{
- XfceShortcut *sc = NULL;
- gchar *base_property;
- gchar *property;
- gchar *command;
-
- g_return_val_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider), NULL);
- g_return_val_if_fail (XFCONF_IS_CHANNEL (provider->priv->channel), NULL);
-
- if (G_LIKELY (xfce_shortcuts_provider_is_custom (provider)))
- base_property = provider->priv->custom_base_property;
- else
- base_property = provider->priv->default_base_property;
-
- property = g_strconcat (base_property, "/", shortcut, NULL);
- command = xfconf_channel_get_string (provider->priv->channel, property, NULL);
-
- if (G_LIKELY (command != NULL))
- {
- sc = g_new0 (XfceShortcut, 1);
- sc->command = command;
- sc->property_name = g_strdup (property);
- sc->shortcut = g_strdup (shortcut);
- }
-
- g_free (property);
-
- return sc;
-}
-
-
-
-gboolean
-xfce_shortcuts_provider_has_shortcut (XfceShortcutsProvider *provider,
- const gchar *shortcut)
-{
- gchar *base_property;
- gchar *property;
- gboolean has_property;
-
- g_return_val_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider), FALSE);
- g_return_val_if_fail (XFCONF_IS_CHANNEL (provider->priv->channel), FALSE);
-
- if (G_LIKELY (xfce_shortcuts_provider_is_custom (provider)))
- base_property = provider->priv->custom_base_property;
- else
- base_property = provider->priv->default_base_property;
-
- property = g_strconcat (base_property, "/", shortcut, NULL);
- has_property = xfconf_channel_has_property (provider->priv->channel, property);
- g_free (property);
-
- return has_property;
-}
-
-
-
-void
-xfce_shortcuts_provider_set_shortcut (XfceShortcutsProvider *provider,
- const gchar *shortcut,
- const gchar *command)
-{
- gchar *property;
-
- g_return_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider));
- g_return_if_fail (XFCONF_IS_CHANNEL (provider->priv->channel));
- g_return_if_fail (shortcut != NULL && command != NULL);
-
- /* Only allow custom shortcuts to be changed */
- if (G_UNLIKELY (!xfce_shortcuts_provider_is_custom (provider)))
- return;
-
- property = g_strconcat (provider->priv->custom_base_property, "/", shortcut, NULL);
-
- if (xfconf_channel_has_property (provider->priv->channel, property))
- xfconf_channel_reset_property (provider->priv->channel, property, FALSE);
-
- xfconf_channel_set_string (provider->priv->channel, property, command);
-
- g_free (property);
-}
-
-
-
-void
-xfce_shortcuts_provider_reset_shortcut (XfceShortcutsProvider *provider,
- const gchar *shortcut)
-{
- gchar *property;
-
- g_return_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (provider));
- g_return_if_fail (XFCONF_IS_CHANNEL (provider->priv->channel));
- g_return_if_fail (shortcut != NULL);
-
- property = g_strconcat (provider->priv->custom_base_property, "/", shortcut, NULL);
-
- DBG ("property = %s", property);
-
- xfconf_channel_reset_property (provider->priv->channel, property, FALSE);
- g_free (property);
-}
-
-
-
-void
-xfce_shortcuts_free (GList *shortcuts)
-{
- g_list_foreach (shortcuts, (GFunc) xfce_shortcut_free, NULL);
-}
-
-
-
-void
-xfce_shortcut_free (XfceShortcut *shortcut)
-{
- if (G_UNLIKELY (shortcut == NULL))
- return;
-
- g_free (shortcut->property_name);
- g_free (shortcut->shortcut);
- g_free (shortcut->command);
- g_free (shortcut);
-}
diff --git a/settings-dialogs/xfce-shortcuts-provider.h b/settings-dialogs/xfce-shortcuts-provider.h
deleted file mode 100644
index 5f1d7c7dc..000000000
--- a/settings-dialogs/xfce-shortcuts-provider.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* vi:set sw=2 sts=2 ts=2 et ai: */
-/*-
- * Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>.
- *
- * 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., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef __XFCE_SHORTCUTS_PROVIDER_H__
-#define __XFCE_SHORTCUTS_PROVIDER_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS;
-
-typedef struct _XfceShortcut XfceShortcut;
-
-typedef struct _XfceShortcutsProviderPrivate XfceShortcutsProviderPrivate;
-typedef struct _XfceShortcutsProviderClass XfceShortcutsProviderClass;
-typedef struct _XfceShortcutsProvider XfceShortcutsProvider;
-
-#define XFCE_TYPE_SHORTCUTS_PROVIDER (xfce_shortcuts_provider_get_type ())
-#define XFCE_SHORTCUTS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_SHORTCUTS_PROVIDER, XfceShortcutsProvider))
-#define XFCE_SHORTCUTS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_SHORTCUTS_PROVIDER, XfceShortcutsProviderClass))
-#define XFCE_IS_SHORTCUTS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_SHORTCUTS_PROVIDER))
-#define XFCE_IS_SHORTCUTS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_SHORTCUTS_PROVIDER)
-#define XFCE_SHORTCUTS_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_SHORTCUTS_PROVIDER, XfceShortcutsProviderClass))
-
-GType xfce_shortcuts_provider_get_type (void) G_GNUC_CONST;
-
-XfceShortcutsProvider *xfce_shortcuts_provider_new (const gchar *name) G_GNUC_MALLOC;
-GList *xfce_shortcuts_provider_get_providers (void) G_GNUC_MALLOC;
-void xfce_shortcuts_provider_free_providers (GList *providers);
-const gchar *xfce_shortcuts_provider_get_name (XfceShortcutsProvider *provider);
-gboolean xfce_shortcuts_provider_is_custom (XfceShortcutsProvider *provider);
-void xfce_shortcuts_provider_reset_to_defaults (XfceShortcutsProvider *provider);
-void xfce_shortcuts_provider_clone_defaults (XfceShortcutsProvider *provider);
-GList *xfce_shortcuts_provider_get_shortcuts (XfceShortcutsProvider *provider);
-XfceShortcut *xfce_shortcuts_provider_get_shortcut (XfceShortcutsProvider *provider,
- const gchar *shortcut);
-gboolean xfce_shortcuts_provider_has_shortcut (XfceShortcutsProvider *provider,
- const gchar *shortcut);
-void xfce_shortcuts_provider_set_shortcut (XfceShortcutsProvider *provider,
- const gchar *shortcut,
- const gchar *command);
-void xfce_shortcuts_provider_reset_shortcut (XfceShortcutsProvider *provider,
- const gchar *shortcut);
-
-void xfce_shortcuts_free (GList *shortcuts);
-void xfce_shortcut_free (XfceShortcut *shortcut);
-
-
-
-struct _XfceShortcutsProviderClass
-{
- GObjectClass __parent__;
-};
-
-struct _XfceShortcutsProvider
-{
- GObject __parent__;
-
- XfceShortcutsProviderPrivate *priv;
-};
-
-struct _XfceShortcut
-{
- gchar *property_name;
- gchar *shortcut;
- gchar *command;
-};
-
-G_END_DECLS;
-
-#endif /* !__XFCE_SHORTCUTS_PROVIDER_H__ */
diff --git a/settings-dialogs/xfwm4-settings.c b/settings-dialogs/xfwm4-settings.c
index 937028dee..b5d345fd8 100644
--- a/settings-dialogs/xfwm4-settings.c
+++ b/settings-dialogs/xfwm4-settings.c
@@ -39,15 +39,13 @@
#include <glade/glade.h>
#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
#include <xfconf/xfconf.h>
+#include <libxfce4kbd-private/xfce-shortcut-dialog.h>
+#include <libxfce4kbd-private/xfce-shortcuts-provider.h>
#include "xfwm4-dialog_glade.h"
#include "xfwm4-settings.h"
-#include "frap-shortcuts-dialog.h"
-#include "xfce-shortcuts-provider.h"
-
#define DEFAULT_THEME "Default"
@@ -989,6 +987,9 @@ main (int argc,
plug = xfwm_settings_create_plug (settings, opt_socket_id);
g_signal_connect (plug, "delete-event", G_CALLBACK (gtk_main_quit), NULL);
+ /* Stop startup notification */
+ gdk_notify_startup_complete ();
+
gtk_main ();
}
@@ -1122,7 +1123,6 @@ xfwm_settings_active_frame_drag_motion (GtkWidget *widget,
active_box = glade_xml_get_widget (settings->priv->glade_xml, "active-box");
children = gtk_container_get_children (GTK_CONTAINER (active_box));
- ix = 0;
for (iter = children; iter != NULL; iter = g_list_next (iter))
{
if (GTK_WIDGET_VISIBLE (iter->data))
@@ -1807,7 +1807,7 @@ xfwm_settings_shortcut_feature_name (const gchar *feature)
static gboolean
-xfwm_settings_validate_shortcut (FrapShortcutsDialog *dialog,
+xfwm_settings_validate_shortcut (XfceShortcutDialog *dialog,
const gchar *shortcut,
XfwmSettings *settings)
{
@@ -1815,10 +1815,11 @@ xfwm_settings_validate_shortcut (FrapShortcutsDialog *dialog,
XfceShortcut *other_shortcut = NULL;
GList *providers;
GList *iter;
+ gchar *property;
gboolean accepted = TRUE;
gint response;
- g_return_val_if_fail (FRAP_IS_SHORTCUTS_DIALOG (dialog), FALSE);
+ g_return_val_if_fail (XFCE_IS_SHORTCUT_DIALOG (dialog), FALSE);
g_return_val_if_fail (XFWM_IS_SETTINGS (settings), FALSE);
g_return_val_if_fail (shortcut != NULL, FALSE);
@@ -1851,12 +1852,12 @@ xfwm_settings_validate_shortcut (FrapShortcutsDialog *dialog,
if (G_UNLIKELY (other_shortcut != NULL))
{
- response = frap_shortcuts_conflict_dialog (xfce_shortcuts_provider_get_name (settings->priv->provider),
- xfce_shortcuts_provider_get_name (other_provider),
- shortcut,
- frap_shortcuts_dialog_get_action_name (dialog),
- xfwm_settings_shortcut_feature_name (other_shortcut->command),
- FALSE);
+ response = xfce_shortcut_conflict_dialog (xfce_shortcuts_provider_get_name (settings->priv->provider),
+ xfce_shortcuts_provider_get_name (other_provider),
+ shortcut,
+ xfce_shortcut_dialog_get_action_name (dialog),
+ xfwm_settings_shortcut_feature_name (other_shortcut->command),
+ FALSE);
accepted = response == GTK_RESPONSE_ACCEPT;
@@ -1898,10 +1899,10 @@ xfwm_settings_shortcut_row_activated (GtkTreeView *tree_view,
SHORTCUTS_SHORTCUT_COLUMN, &shortcut, -1);
/* Request a new shortcut from the user */
- dialog = frap_shortcuts_dialog_new ("xfwm4", name, feature);
+ dialog = xfce_shortcut_dialog_new ("xfwm4", name, feature);
g_signal_connect (dialog, "validate-shortcut",
G_CALLBACK (xfwm_settings_validate_shortcut), settings);
- response = frap_shortcuts_dialog_run (FRAP_SHORTCUTS_DIALOG (dialog));
+ response = xfce_shortcut_dialog_run (XFCE_SHORTCUT_DIALOG (dialog));
if (G_LIKELY (response == GTK_RESPONSE_OK))
{
@@ -1910,7 +1911,7 @@ xfwm_settings_shortcut_row_activated (GtkTreeView *tree_view,
xfce_shortcuts_provider_reset_shortcut (settings->priv->provider, shortcut);
/* Get new shortcut entered by the user */
- new_shortcut = frap_shortcuts_dialog_get_shortcut (FRAP_SHORTCUTS_DIALOG (dialog));
+ new_shortcut = xfce_shortcut_dialog_get_shortcut (XFCE_SHORTCUT_DIALOG (dialog));
/* Save new shortcut */
xfce_shortcuts_provider_set_shortcut (settings->priv->provider, new_shortcut, feature);