diff options
author | Jonathan Blandford <jrb@redhat.com> | 2003-08-01 17:36:57 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2003-08-01 17:36:57 +0000 |
commit | 22e9266f7840a7cde2b26f6bf02a99c25c3db574 (patch) | |
tree | 1dfd339320f130b40bb77d41d74f202d0c112e2c /capplets/mouse | |
parent | 2e32bbe92055053e68666066f7bbc3aca6a9df96 (diff) | |
download | gnome-control-center-22e9266f7840a7cde2b26f6bf02a99c25c3db574.tar.gz |
add support for Xcursors.
Fri Aug 1 13:06:04 2003 Jonathan Blandford <jrb@redhat.com>
* gnome-mouse-properties.c (create_dialog): add support for
Xcursors.
Diffstat (limited to 'capplets/mouse')
-rw-r--r-- | capplets/mouse/ChangeLog | 5 | ||||
-rw-r--r-- | capplets/mouse/gnome-mouse-properties.c | 106 | ||||
-rw-r--r-- | capplets/mouse/gnome-mouse-properties.glade | 106 |
3 files changed, 186 insertions, 31 deletions
diff --git a/capplets/mouse/ChangeLog b/capplets/mouse/ChangeLog index d5d3b9716..0b03c9245 100644 --- a/capplets/mouse/ChangeLog +++ b/capplets/mouse/ChangeLog @@ -1,3 +1,8 @@ +Fri Aug 1 13:06:04 2003 Jonathan Blandford <jrb@redhat.com> + + * gnome-mouse-properties.c (create_dialog): add support for + Xcursors. + Thu Jul 24 16:14:33 2003 Jonathan Blandford <jrb@redhat.com> * gnome-mouse-properties.c (setup_dialog): remove the float_to_int diff --git a/capplets/mouse/gnome-mouse-properties.c b/capplets/mouse/gnome-mouse-properties.c index e8fd9737e..c75a5f6b4 100644 --- a/capplets/mouse/gnome-mouse-properties.c +++ b/capplets/mouse/gnome-mouse-properties.c @@ -23,9 +23,7 @@ * 02111-1307, USA. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include <config.h> #include <string.h> #include <gnome.h> @@ -98,10 +96,17 @@ enum * define the macro */ #define DOUBLE_CLICK_KEY "/desktop/gnome/peripherals/mouse/double_click" -#define CURSOR_FONT_KEY "/desktop/gnome/peripherals/mouse/cursor_font" +#define CURSOR_FONT_KEY "/desktop/gnome/peripherals/mouse/cursor_font" +#define CURSOR_SIZE_KEY "/desktop/gnome/peripherals/mouse/cursor_size" GConfClient *client; +#ifdef HAVE_XCURSOR +static gboolean server_supports_xcursor = TRUE; +#else +static gboolean server_supports_xcursor = FALSE; +#endif + /* State in testing the double-click speed. Global for a great deal of * convenience */ @@ -237,6 +242,60 @@ drag_threshold_from_gconf (GConfPropertyEditor *peditor, return new_value; } +static GConfValue * +cursor_size_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) +{ + GConfValue *new_value; + gint widget_val; + + widget_val = gconf_value_get_int (value); + + new_value = gconf_value_new (GCONF_VALUE_INT); + switch (widget_val) { + case 12: + gconf_value_set_int (new_value, 0); + break; + case 24: + gconf_value_set_int (new_value, 1); + break; + case 36: + gconf_value_set_int (new_value, 2); + break; + default: + gconf_value_set_int (new_value, -1); + break; + } + + return new_value; +} + +static GConfValue * +cursor_size_from_widget (GConfPropertyEditor *peditor, const GConfValue *value) +{ + GConfValue *new_value; + gint radio_val; + + radio_val = gconf_value_get_int (value); + + new_value = gconf_value_new (GCONF_VALUE_INT); + switch (radio_val) { + case 0: + gconf_value_set_int (new_value, 12); + break; + case 1: + gconf_value_set_int (new_value, 24); + break; + case 2: + gconf_value_set_int (new_value, 36); + break; + default: + g_assert_not_reached (); + break; + } + + return new_value; +} + /* Retrieve legacy settings */ static void @@ -514,6 +573,9 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset) tree_view = WID ("cursor_tree"); cursor_font = read_cursor_font (); + + + model = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), model); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); @@ -619,7 +681,16 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset) gconf_peditor_new_boolean (changeset, "/desktop/gnome/peripherals/mouse/locate_pointer", WID ("locate_pointer_toggle"), NULL); - /* Motion page */ + + gconf_peditor_new_select_radio (changeset, + CURSOR_SIZE_KEY, + gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("cursor_size_small_radio"))), + "conv-to-widget-cb", cursor_size_to_widget, + "conv-from-widget-cb", cursor_size_from_widget, + NULL); + + + /* Motion page */ /* speed */ gconf_peditor_new_numeric_range (changeset, DOUBLE_CLICK_KEY, WID ("delay_scale"), @@ -659,16 +730,35 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset) static GladeXML * create_dialog (void) { - GtkWidget *widget; GladeXML *dialog; GtkSizeGroup *size_group; + gchar *text; /* register the custom type */ (void) mouse_capplet_check_button_get_type (); dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-mouse-properties.glade", "mouse_properties_dialog", NULL); - widget = glade_xml_get_widget (dialog, "prefs_widget"); + if (server_supports_xcursor) { + gtk_widget_hide (WID ("cursor_font_vbox")); + gtk_widget_show (WID ("cursor_size_vbox")); + text = g_strdup_printf ("<b>%s</b>", _("Cursor Size")); + gtk_label_set_markup (GTK_LABEL (WID ("cursor_category_label")), text); + g_free (text); + gtk_box_set_child_packing (GTK_BOX (WID ("cursors_vbox")), + WID ("cursor_appearance_vbox"), + FALSE, TRUE, 0, GTK_PACK_START); + } else { + gtk_widget_hide (WID ("cursor_size_vbox")); + gtk_widget_show (WID ("cursor_font_vbox")); + text = g_strdup_printf ("<b>%s</b>", _("Cursor Theme")); + gtk_label_set_markup (GTK_LABEL (WID ("cursor_category_label")), text); + g_free (text); + gtk_box_set_child_packing (GTK_BOX (WID ("cursors_vbox")), + WID ("cursor_appearance_vbox"), + TRUE, TRUE, 0, GTK_PACK_START); + } + size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_size_group_add_widget (size_group, WID ("acceleration_label")); gtk_size_group_add_widget (size_group, WID ("sensitivity_label")); @@ -744,7 +834,7 @@ main (int argc, char **argv) G_CALLBACK (dialog_response_cb), changeset); capplet_set_icon (dialog_win, "mouse-capplet.png"); - gtk_widget_show_all (dialog_win); + gtk_widget_show (dialog_win); gtk_main (); } diff --git a/capplets/mouse/gnome-mouse-properties.glade b/capplets/mouse/gnome-mouse-properties.glade index a3f618580..ffcd12ccf 100644 --- a/capplets/mouse/gnome-mouse-properties.glade +++ b/capplets/mouse/gnome-mouse-properties.glade @@ -461,15 +461,15 @@ <property name="spacing">18</property> <child> - <widget class="GtkVBox" id="vbox10"> + <widget class="GtkVBox" id="cursor_appearance_vbox"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> - <widget class="GtkLabel" id="theme_category_label"> + <widget class="GtkLabel" id="cursor_category_label"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Cursor Theme</b></property> + <property name="label" translatable="yes"></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -521,19 +521,66 @@ <property name="spacing">6</property> <child> - <widget class="GtkLabel" id="label17"> + <widget class="GtkVBox" id="cursor_size_vbox"> <property name="visible">True</property> - <property name="label" translatable="yes">Cursor _themes:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">cursor_tree</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkRadioButton" id="cursor_size_small_radio"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Small</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="cursor_size_medium_radio"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Medium</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">cursor_size_small_radio</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="cursor_size_large_radio"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Large</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">cursor_size_small_radio</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> @@ -543,14 +590,27 @@ </child> <child> - <widget class="GtkTreeView" id="cursor_tree"> - <property name="width_request">350</property> + <widget class="GtkVBox" id="cursor_font_vbox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - <property name="rules_hint">True</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkTreeView" id="cursor_tree"> + <property name="width_request">350</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="headers_visible">False</property> + <property name="rules_hint">False</property> + <property name="reorderable">False</property> + <property name="enable_search">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> @@ -602,7 +662,7 @@ </child> <child> - <widget class="GtkVBox" id="vbox11"> + <widget class="GtkVBox" id="cursor_locate_pointer_vbox"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> |