summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-25 03:30:17 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2007-04-25 03:30:17 +0000
commit1724fa36f1955e5d3a2e971918647763024a0ecd (patch)
tree58d2a9df57b66a75ed5c1841063fe5419bba692f
parenta50b3c7a2b05146ca706fd0559945874bcfd094f (diff)
downloadmetacity-1724fa36f1955e5d3a2e971918647763024a0ecd.tar.gz
Add code to configure what happens when the titlebar is right or middle
2007-04-24 Linus Torvalds <torvalds@woody.linux-foundation.org> * src/prefs.[ch] (init_action_meta_prefs, meta_prefs_init, action_change_titlebar, change_notify, update_action_titlebar, meta_preference_to_string): Add code to configure what happens when the titlebar is right or middle clicked as well as double clicked. svn path=/trunk/; revision=3214
-rw-r--r--ChangeLog8
-rw-r--r--src/prefs.c90
-rw-r--r--src/prefs.h2
3 files changed, 73 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 7948d89a..36467c9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-04-24 Linus Torvalds <torvalds@woody.linux-foundation.org>
+
+ * src/prefs.[ch] (init_action_meta_prefs, meta_prefs_init,
+ action_change_titlebar, change_notify, update_action_titlebar,
+ meta_preference_to_string): Add code to configure what happens
+ when the titlebar is right or middle clicked as well as
+ double clicked.
+
2007-04-23 Elijah Newren <newren gmail com>
* configure.in: post-release bump to 2.19.8.
diff --git a/src/prefs.c b/src/prefs.c
index a44169e7..39fddf39 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -144,7 +144,7 @@ static gboolean update_visual_bell_type (const char *value);
static gboolean update_num_workspaces (int value);
static gboolean update_application_based (gboolean value);
static gboolean update_disable_workarounds (gboolean value);
-static gboolean update_action_double_click_titlebar (const char *value);
+static gboolean update_action_titlebar (const char *key, const char *value, MetaActionTitlebar *action);
static gboolean update_auto_raise (gboolean value);
static gboolean update_auto_raise_delay (int value);
static gboolean update_button_layout (const char *value);
@@ -353,6 +353,20 @@ get_bool (const char *key, gboolean *val)
return filled_in;
}
+
+static void
+init_action_meta_prefs(const char *key, MetaActionTitlebar *action)
+{
+ GError *err = NULL;
+ char *str_val;
+
+ str_val = gconf_client_get_string (default_client,
+ key,
+ &err);
+ cleanup_error (&err);
+ update_action_titlebar (key, str_val, action);
+ g_free (str_val);
+}
#endif /* HAVE_GCONF */
void
@@ -413,12 +427,9 @@ meta_prefs_init (void)
if (get_bool (KEY_RAISE_ON_CLICK, &bool_val))
update_raise_on_click (bool_val);
- str_val = gconf_client_get_string (default_client,
- KEY_ACTION_DOUBLE_CLICK_TITLEBAR,
- &err);
- cleanup_error (&err);
- update_action_double_click_titlebar (str_val);
- g_free (str_val);
+ init_action_meta_prefs (KEY_ACTION_DOUBLE_CLICK_TITLEBAR, &action_double_click_titlebar);
+ init_action_meta_prefs (KEY_ACTION_MIDDLE_CLICK_TITLEBAR, &action_middle_click_titlebar);
+ init_action_meta_prefs (KEY_ACTION_RIGHT_CLICK_TITLEBAR, &action_right_click_titlebar);
if (get_bool (KEY_AUTO_RAISE, &bool_val))
update_auto_raise (bool_val);
@@ -558,6 +569,23 @@ meta_prefs_init (void)
#ifdef HAVE_GCONF
+static gboolean
+action_change_titlebar (const char *key, GConfValue *value, MetaActionTitlebar *action)
+{
+ const char *str;
+
+ if (value && value->type != GCONF_VALUE_STRING)
+ {
+ meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
+ key);
+ return FALSE;
+ }
+
+ str = value ? gconf_value_get_string (value) : NULL;
+
+ return update_action_titlebar (key, str, action);
+}
+
static void
change_notify (GConfClient *client,
guint cnxn_id,
@@ -806,19 +834,21 @@ change_notify (GConfClient *client,
}
else if (strcmp (key, KEY_ACTION_DOUBLE_CLICK_TITLEBAR) == 0)
{
- const char *str;
-
- if (value && value->type != GCONF_VALUE_STRING)
- {
- meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
- key);
- goto out;
- }
-
- str = value ? gconf_value_get_string (value) : NULL;
-
- if (update_action_double_click_titlebar (str))
+ if (action_change_titlebar(KEY_ACTION_DOUBLE_CLICK_TITLEBAR, value, &action_double_click_titlebar))
queue_changed (META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR);
+ return;
+ }
+ else if (strcmp (key, KEY_ACTION_MIDDLE_CLICK_TITLEBAR) == 0)
+ {
+ if (action_change_titlebar(KEY_ACTION_MIDDLE_CLICK_TITLEBAR, value, &action_middle_click_titlebar))
+ queue_changed (META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR);
+ return;
+ }
+ else if (strcmp (key, KEY_ACTION_RIGHT_CLICK_TITLEBAR) == 0)
+ {
+ if (action_change_titlebar(KEY_ACTION_RIGHT_CLICK_TITLEBAR, value, &action_right_click_titlebar))
+ queue_changed (META_PREF_ACTION_RIGHT_CLICK_TITLEBAR);
+ return;
}
else if (strcmp (key, KEY_AUTO_RAISE) == 0)
{
@@ -1653,23 +1683,23 @@ action_titlebar_from_string (const char *str)
}
static gboolean
-update_action_double_click_titlebar (const char *value)
+update_action_titlebar (const char *key, const char *value, MetaActionTitlebar *action)
{
- MetaActionTitlebar old_action = action_double_click_titlebar;
+ MetaActionTitlebar old_action = *action, new_action = old_action;
if (value != NULL)
{
- action_double_click_titlebar = action_titlebar_from_string (value);
+ new_action = action_titlebar_from_string (value);
- if (action_double_click_titlebar == META_ACTION_TITLEBAR_LAST)
+ if (new_action == META_ACTION_TITLEBAR_LAST)
{
- action_double_click_titlebar = old_action;
- meta_warning (_("GConf key '%s' is set to an invalid value\n"),
- KEY_ACTION_DOUBLE_CLICK_TITLEBAR);
+ new_action = old_action;
+ meta_warning (_("GConf key '%s' is set to an invalid value\n"), key);
}
+ *action = new_action;
}
- return (old_action != action_double_click_titlebar);
+ return (old_action != new_action);
}
static gboolean
@@ -1765,6 +1795,12 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR:
return "ACTION_DOUBLE_CLICK_TITLEBAR";
+ case META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR:
+ return "ACTION_MIDDLE_CLICK_TITLEBAR";
+
+ case META_PREF_ACTION_RIGHT_CLICK_TITLEBAR:
+ return "ACTION_RIGHT_CLICK_TITLEBAR";
+
case META_PREF_AUTO_RAISE:
return "AUTO_RAISE";
diff --git a/src/prefs.h b/src/prefs.h
index f07a5c9d..4f2deef2 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -36,6 +36,8 @@ typedef enum
META_PREF_FOCUS_NEW_WINDOWS,
META_PREF_RAISE_ON_CLICK,
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
+ META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR,
+ META_PREF_ACTION_RIGHT_CLICK_TITLEBAR,
META_PREF_AUTO_RAISE,
META_PREF_AUTO_RAISE_DELAY,
META_PREF_THEME,