Author: jannis
Date: 2008-10-20 17:11:54 +0000 (Mon, 20 Oct 2008)
New Revision: 28328
Modified:
xfce4-settings/trunk/common/xfce-shortcuts-grabber.c
xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts-dialog.c
xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts-dialog.h
xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts.c
xfce4-settings/trunk/dialogs/keyboard-settings/keyboard-dialog.glade
xfce4-settings/trunk/dialogs/keyboard-settings/xfce-keyboard-settings.c
Log:
Sync Frap code. Don't strip Meta_L/Meta_R flags from modifier bits. That
seems to give odd results and needs some testing. Improve the shortcuts
tab a bit. Add question dialog before resetting to defaults, just like
in the xfwm4 settings dialog.
Modified: xfce4-settings/trunk/common/xfce-shortcuts-grabber.c
===================================================================
--- xfce4-settings/trunk/common/xfce-shortcuts-grabber.c 2008-10-20
16:59:45 UTC (rev 28327)
+++ xfce4-settings/trunk/common/xfce-shortcuts-grabber.c 2008-10-20
17:11:54 UTC (rev 28328)
@@ -482,11 +482,13 @@
modifiers ^= grabber->priv->modifiers[CACHE_HYPER];
}
+#if 0
if ((modifiers & grabber->priv->modifiers[CACHE_META]) != 0)
{
modifiers |= GDK_META_MASK;
modifiers ^= grabber->priv->modifiers[CACHE_META];
}
+#endif
return gtk_accelerator_name (keysym, modifiers);
}
Modified: xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts-dialog.c
===================================================================
--- xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts-dialog.c
2008-10-20 16:59:45 UTC (rev 28327)
+++ xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts-dialog.c
2008-10-20 17:11:54 UTC (rev 28328)
@@ -22,7 +22,6 @@
#include <config.h>
#endif
-#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
@@ -41,6 +40,7 @@
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);
@@ -69,6 +69,7 @@
GtkWidget *shortcut_label;
+ gchar *action_name;
gchar *action;
gchar *shortcut;
};
@@ -203,6 +204,7 @@
{
FrapShortcutsDialog *dialog = FRAP_SHORTCUTS_DIALOG (object);
+ g_free (dialog->action_name);
g_free (dialog->action);
g_free (dialog->shortcut);
@@ -213,14 +215,16 @@
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);
+ frap_shortcuts_dialog_create_contents (dialog, provider, action_name,
action);
return GTK_WIDGET (dialog);
}
@@ -230,6 +234,7 @@
static void
frap_shortcuts_dialog_create_contents (FrapShortcutsDialog *dialog,
const gchar *provider,
+ const gchar *action_name,
const gchar *action)
{
GtkWidget *button;
@@ -241,17 +246,17 @@
if (g_utf8_collate (provider, "xfwm4") == 0)
{
title = _("Enter window manager action shortcut");
- subtitle = g_strdup_printf (_("Action: %s"), action);
+ 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);
+ subtitle = g_strdup_printf (_("Command: %s"), action_name);
}
else
{
title = _("Enter shortcut");
- subtitle = g_strdup_printf (_("Action: %s"), action);
+ subtitle = g_strdup_printf (_("Action: %s"), action_name);
}
/* Set dialog title */
@@ -376,6 +381,11 @@
/* 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;
}
@@ -430,8 +440,10 @@
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;
@@ -476,3 +488,12 @@
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;
+}
Modified: xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts-dialog.h
===================================================================
--- xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts-dialog.h
2008-10-20 16:59:45 UTC (rev 28327)
+++ xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts-dialog.h
2008-10-20 17:11:54 UTC (rev 28328)
@@ -37,13 +37,15 @@
#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;
+GType frap_shortcuts_dialog_get_type (void) G_GNUC_CONST;
-GtkWidget *frap_shortcuts_dialog_new (const gchar *provider,
- 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);
+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;
Modified: xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts.c
===================================================================
--- xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts.c
2008-10-20 16:59:45 UTC (rev 28327)
+++ xfce4-settings/trunk/dialogs/keyboard-settings/frap-shortcuts.c
2008-10-20 17:11:54 UTC (rev 28328)
@@ -51,10 +51,10 @@
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 this action"), N_("Keep the other one") },
+ 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 this action"), N_("Keep %s") },
+ 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") },
@@ -131,7 +131,7 @@
if (G_UNLIKELY (!handled))
{
xfce_message_dialog (NULL, title, GTK_STOCK_DIALOG_ERROR,
- _("The shortcut is already being used for something
else."), NULL,
+ primary_text, _("The shortcut is already being used
for something else."),
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
response = GTK_RESPONSE_REJECT;
}
Modified: xfce4-settings/trunk/dialogs/keyboard-settings/keyboard-dialog.glade
===================================================================
--- xfce4-settings/trunk/dialogs/keyboard-settings/keyboard-dialog.glade
2008-10-20 16:59:45 UTC (rev 28327)
+++ xfce4-settings/trunk/dialogs/keyboard-settings/keyboard-dialog.glade
2008-10-20 17:11:54 UTC (rev 28328)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Sun Oct 19 01:30:18 2008 -->
+<!--Generated with glade3 3.4.5 on Mon Oct 20 19:08:43 2008 -->
<glade-interface>
<requires lib="xfce4"/>
<widget class="XfceTitledDialog" id="keyboard-settings-dialog">
@@ -374,8 +374,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property
name="receives_default">True</property>
- <property name="label"
translatable="yes">gtk-revert-to-saved</property>
- <property name="use_stock">True</property>
+ <property name="label"
translatable="yes">_Reset to Defaults</property>
+ <property
name="use_underline">True</property>
<property name="response_id">0</property>
</widget>
<packing>
Modified:
xfce4-settings/trunk/dialogs/keyboard-settings/xfce-keyboard-settings.c
===================================================================
--- xfce4-settings/trunk/dialogs/keyboard-settings/xfce-keyboard-settings.c
2008-10-20 16:59:45 UTC (rev 28327)
+++ xfce4-settings/trunk/dialogs/keyboard-settings/xfce-keyboard-settings.c
2008-10-20 17:11:54 UTC (rev 28328)
@@ -367,14 +367,12 @@
/* Connect to reset button */
button = glade_xml_get_widget (settings->priv->glade_xml,
"reset_shortcuts_button");
+ gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock
(GTK_STOCK_REVERT_TO_SAVED, GTK_ICON_SIZE_BUTTON));
g_signal_connect_swapped (button, "clicked", G_CALLBACK
(xfce_keyboard_settings_reset_button_clicked), settings);
xfce_keyboard_settings_initialize_shortcuts (settings);
xfce_keyboard_settings_load_shortcuts (settings);
- /* TODO: Handle property-changed signal */
- /* TODO: Handle 'Add' and 'Remove' buttons */
-
#ifdef HAVE_LIBXKLAVIER
/* Init xklavier engine */
settings->priv->xkl_engine = xkl_engine_get_instance (GDK_DISPLAY());
@@ -656,7 +654,7 @@
DBG ("shortcut = %s, command = %s", shortcut, command);
/* Request a new shortcut from the user */
- dialog = frap_shortcuts_dialog_new ("commands", command);
+ dialog = frap_shortcuts_dialog_new ("commands", command, command);
g_signal_connect (dialog, "validate-shortcut", G_CALLBACK
(xfce_keyboard_settings_validate_shortcut), settings);
response = frap_shortcuts_dialog_run (FRAP_SHORTCUTS_DIALOG (dialog));
@@ -765,7 +763,7 @@
response = frap_shortcuts_conflict_dialog
(xfce_shortcuts_provider_get_name (settings->priv->provider),
xfce_shortcuts_provider_get_name (info->provider),
shortcut,
-
frap_shortcuts_dialog_get_action (dialog),
+
frap_shortcuts_dialog_get_action_name (dialog),
info->shortcut->command,
FALSE);
@@ -943,7 +941,7 @@
gtk_widget_hide (command_dialog);
/* Create shortcut dialog */
- shortcut_dialog = frap_shortcuts_dialog_new ("commands", command);
+ shortcut_dialog = frap_shortcuts_dialog_new ("commands", command,
command);
g_signal_connect (shortcut_dialog, "validate-shortcut", G_CALLBACK
(xfce_keyboard_settings_validate_shortcut), settings);
/* Run shortcut dialog until a valid shortcut is entered or the dialog
is cancelled */
@@ -1029,8 +1027,20 @@
static void
xfce_keyboard_settings_reset_button_clicked (XfceKeyboardSettings *settings)
{
+ gint response;
+
g_return_if_fail (XFCE_IS_KEYBOARD_SETTINGS (settings));
- xfce_shortcuts_provider_reset_to_defaults (settings->priv->provider);
+
+ response = xfce_message_dialog (NULL, _("Reset to Defaults"),
GTK_STOCK_DIALOG_QUESTION,
+ _("Reset to Defaults"),
+ _("This will reset <b>all</b> shortcuts to
their default "
+ "values. Do you really want to do this?"),
+ GTK_STOCK_NO, GTK_RESPONSE_NO,
+ GTK_STOCK_YES, GTK_RESPONSE_YES,
+ NULL);
+
+ if (G_LIKELY (response == GTK_RESPONSE_YES))
+ xfce_shortcuts_provider_reset_to_defaults (settings->priv->provider);
}
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits