Lots of things. Fix drag threshold preference, use a GtkImage instead of a
2002-05-12 Anders Carlsson <andersca@gnu.org> * gnome-mouse-properties.c: (drag_threshold_from_gconf), (drag_threshold_to_gconf), (event_box_button_press_event), (load_pixbufs), (setup_dialog), (create_dialog), (dialog_response_cb), (main): * gnome-mouse-properties.glade: Lots of things. Fix drag threshold preference, use a GtkImage instead of a GtkDrawingArea for the double click test. Remove weird weak refs throughout the code. Clean up the glade file, requires a new libglade that has an a11y ref count fix.
This commit is contained in:
parent
69d701578d
commit
8145d7fa30
3 changed files with 188 additions and 72 deletions
|
@ -1,3 +1,15 @@
|
|||
2002-05-12 Anders Carlsson <andersca@gnu.org>
|
||||
|
||||
* gnome-mouse-properties.c: (drag_threshold_from_gconf),
|
||||
(drag_threshold_to_gconf), (event_box_button_press_event),
|
||||
(load_pixbufs), (setup_dialog), (create_dialog),
|
||||
(dialog_response_cb), (main):
|
||||
* gnome-mouse-properties.glade:
|
||||
Lots of things. Fix drag threshold preference, use a GtkImage
|
||||
instead of a GtkDrawingArea for the double click test. Remove
|
||||
weird weak refs throughout the code. Clean up the glade file,
|
||||
requires a new libglade that has an a11y ref count fix.
|
||||
|
||||
2002-05-10 Anders Carlsson <andersca@gnu.org>
|
||||
|
||||
* gnome-mouse-properties.c: (get_default_mouse_info),
|
||||
|
|
|
@ -199,6 +199,26 @@ threshold_to_gconf (GConfPropertyEditor *peditor,
|
|||
return gconf_value_float_to_int (value);
|
||||
}
|
||||
|
||||
static GConfValue *
|
||||
drag_threshold_from_gconf (GConfPropertyEditor *peditor,
|
||||
const GConfValue *value)
|
||||
{
|
||||
GConfValue *new_value;
|
||||
|
||||
new_value = gconf_value_new (GCONF_VALUE_FLOAT);
|
||||
|
||||
gconf_value_set_float (new_value, CLAMP (gconf_value_get_int (value), 1, 10));
|
||||
|
||||
return new_value;
|
||||
}
|
||||
|
||||
static GConfValue *
|
||||
drag_threshold_to_gconf (GConfPropertyEditor *peditor,
|
||||
const GConfValue *value)
|
||||
{
|
||||
return gconf_value_float_to_int (value);
|
||||
}
|
||||
|
||||
/* Retrieve legacy settings */
|
||||
|
||||
static void
|
||||
|
@ -229,22 +249,25 @@ test_maybe_timeout (struct test_data_t *data)
|
|||
|
||||
/* Callback issued when the user clicks the double click testing area. */
|
||||
|
||||
static gint
|
||||
drawing_area_button_press_event (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GConfChangeSet *changeset)
|
||||
static gboolean
|
||||
event_box_button_press_event (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GConfChangeSet *changeset)
|
||||
{
|
||||
gint double_click_time;
|
||||
GConfValue *value;
|
||||
|
||||
static struct test_data_t data;
|
||||
static guint test_on_timeout_id = 0;
|
||||
static guint test_maybe_timeout_id = 0;
|
||||
static guint32 double_click_timestamp = 0;
|
||||
|
||||
GtkWidget *image;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
|
||||
if (event->type != GDK_BUTTON_PRESS)
|
||||
return FALSE;
|
||||
|
||||
image = g_object_get_data (G_OBJECT (widget), "image");
|
||||
|
||||
if (!(changeset && gconf_change_set_check_value (changeset, DOUBLE_CLICK_KEY, &value)))
|
||||
double_click_time = gconf_client_get_int (gconf_client_get_default (), DOUBLE_CLICK_KEY, NULL);
|
||||
else
|
||||
|
@ -276,31 +299,6 @@ drawing_area_button_press_event (GtkWidget *widget,
|
|||
}
|
||||
|
||||
double_click_timestamp = event->time;
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Callback to display the appropriate image on the double click testing area. */
|
||||
|
||||
static gint
|
||||
drawing_area_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
GConfChangeSet *changeset)
|
||||
{
|
||||
static gboolean first_time = TRUE;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
|
||||
if (first_time) {
|
||||
gdk_window_set_events (widget->window, gdk_window_get_events (widget->window) | GDK_BUTTON_PRESS_MASK);
|
||||
g_signal_connect (G_OBJECT (widget), "button_press_event", (GCallback) drawing_area_button_press_event, changeset);
|
||||
first_time = FALSE;
|
||||
}
|
||||
|
||||
gdk_draw_rectangle (widget->window, widget->style->white_gc,
|
||||
TRUE, 0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
switch (double_click_state) {
|
||||
case DOUBLE_CLICK_TEST_ON:
|
||||
|
@ -314,13 +312,8 @@ drawing_area_expose_event (GtkWidget *widget,
|
|||
break;
|
||||
}
|
||||
|
||||
gdk_pixbuf_render_to_drawable_alpha
|
||||
(pixbuf, widget->window,
|
||||
0, 0,
|
||||
(widget->allocation.width - gdk_pixbuf_get_width (pixbuf)) / 2,
|
||||
(widget->allocation.height - gdk_pixbuf_get_height (pixbuf)) / 2,
|
||||
-1, -1, GDK_PIXBUF_ALPHA_FULL, 0, GDK_RGB_DITHER_NORMAL, 0, 0);
|
||||
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -356,27 +349,22 @@ load_pixbufs (void)
|
|||
|
||||
filename = gnome_program_locate_file (program, GNOME_FILE_DOMAIN_APP_PIXMAP, "mouse-left.png", TRUE, NULL);
|
||||
left_handed_pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
||||
g_object_add_weak_pointer (G_OBJECT (left_handed_pixbuf), (gpointer *) &left_handed_pixbuf);
|
||||
g_free (filename);
|
||||
|
||||
filename = gnome_program_locate_file (program, GNOME_FILE_DOMAIN_APP_PIXMAP, "mouse-right.png", TRUE, NULL);
|
||||
right_handed_pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
||||
g_object_add_weak_pointer (G_OBJECT (right_handed_pixbuf), (gpointer *) &right_handed_pixbuf);
|
||||
g_free (filename);
|
||||
|
||||
filename = gnome_program_locate_file (program, GNOME_FILE_DOMAIN_APP_PIXMAP, "double-click-on.png", TRUE, NULL);
|
||||
double_click_on_pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
||||
g_object_add_weak_pointer (G_OBJECT (double_click_on_pixbuf), (gpointer *) &double_click_on_pixbuf);
|
||||
g_free (filename);
|
||||
|
||||
filename = gnome_program_locate_file (program, GNOME_FILE_DOMAIN_APP_PIXMAP, "double-click-maybe.png", TRUE, NULL);
|
||||
double_click_maybe_pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
||||
g_object_add_weak_pointer (G_OBJECT (double_click_maybe_pixbuf), (gpointer *) &double_click_maybe_pixbuf);
|
||||
g_free (filename);
|
||||
|
||||
filename = gnome_program_locate_file (program, GNOME_FILE_DOMAIN_APP_PIXMAP, "double-click-off.png", TRUE, NULL);
|
||||
double_click_off_pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
||||
g_object_add_weak_pointer (G_OBJECT (double_click_off_pixbuf), (gpointer *) &double_click_off_pixbuf);
|
||||
g_free (filename);
|
||||
|
||||
called = TRUE;
|
||||
|
@ -532,8 +520,11 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
|||
gconf_value_free (value);
|
||||
|
||||
/* Double-click time */
|
||||
g_signal_connect (WID ("double_click_darea"), "expose_event", (GCallback) drawing_area_expose_event, changeset);
|
||||
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (WID ("double_click_image")), double_click_off_pixbuf);
|
||||
g_object_set_data (G_OBJECT (WID ("double_click_eventbox")), "image", WID ("double_click_image"));
|
||||
g_signal_connect (WID ("double_click_eventbox"), "button_press_event",
|
||||
G_CALLBACK (event_box_button_press_event), changeset);
|
||||
|
||||
/* Cursors page */
|
||||
tree_view = WID ("cursor_tree");
|
||||
cursor_font = read_cursor_font ();
|
||||
|
@ -665,8 +656,8 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
|||
/* DnD threshold */
|
||||
gconf_peditor_new_numeric_range
|
||||
(changeset, "/desktop/gnome/peripherals/mouse/drag_threshold", WID ("drag_threshold_scale"),
|
||||
"conv-to-widget-cb", threshold_from_gconf,
|
||||
"conv-from-widget-cb", threshold_to_gconf,
|
||||
"conv-to-widget-cb", drag_threshold_from_gconf,
|
||||
"conv-from-widget-cb", drag_threshold_to_gconf,
|
||||
NULL);
|
||||
|
||||
/* listen to cursors changing */
|
||||
|
@ -688,7 +679,7 @@ create_dialog (void)
|
|||
GladeXML *dialog;
|
||||
GtkSizeGroup *size_group;
|
||||
|
||||
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-mouse-properties.glade", "prefs_widget", NULL);
|
||||
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-mouse-properties.glade", "mouse_properties_dialog", NULL);
|
||||
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
||||
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
@ -706,15 +697,13 @@ create_dialog (void)
|
|||
gtk_size_group_add_widget (size_group, WID ("slow_label"));
|
||||
gtk_size_group_add_widget (size_group, WID ("small_label"));
|
||||
|
||||
g_object_weak_ref (G_OBJECT (widget), (GWeakNotify) g_object_unref, dialog);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
/* Callback issued when a button is clicked on the dialog */
|
||||
|
||||
static void
|
||||
dialog_button_clicked_cb (GtkDialog *dialog, gint response_id, GConfChangeSet *changeset)
|
||||
dialog_response_cb (GtkDialog *dialog, gint response_id, GConfChangeSet *changeset)
|
||||
{
|
||||
if (response_id == GTK_RESPONSE_HELP) {
|
||||
GError *error = NULL;
|
||||
|
@ -766,17 +755,13 @@ main (int argc, char **argv)
|
|||
} else {
|
||||
changeset = NULL;
|
||||
dialog = create_dialog ();
|
||||
load_pixbufs ();
|
||||
setup_dialog (dialog, changeset);
|
||||
// load_pixbufs ();
|
||||
// setup_dialog (dialog, changeset);
|
||||
|
||||
dialog_win = gtk_dialog_new_with_buttons
|
||||
(_("Mouse Properties"), NULL, 0,
|
||||
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
||||
NULL);
|
||||
dialog_win = WID ("mouse_properties_dialog");
|
||||
g_signal_connect (dialog_win, "response",
|
||||
G_CALLBACK (dialog_response_cb), changeset);
|
||||
|
||||
g_signal_connect (G_OBJECT (dialog_win), "response", (GCallback) dialog_button_clicked_cb, changeset);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_win)->vbox), WID ("prefs_widget"), TRUE, TRUE, GNOME_PAD_SMALL);
|
||||
gtk_widget_show_all (dialog_win);
|
||||
|
||||
gtk_main ();
|
||||
|
|
|
@ -80,8 +80,8 @@
|
|||
<child>
|
||||
<widget class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Mouse Orientation</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
|
@ -165,6 +165,25 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Mouse Orientation</property>
|
||||
<property name="use_underline">False</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.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -176,8 +195,8 @@
|
|||
<child>
|
||||
<widget class="GtkFrame" id="frame2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Double-click Delay</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
|
@ -286,14 +305,16 @@
|
|||
<property name="yscale">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame4">
|
||||
<widget class="GtkEventBox" id="double_click_eventbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkDrawingArea" id="double_click_darea">
|
||||
<widget class="GtkImage" id="double_click_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
@ -307,6 +328,25 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Double-click Delay</property>
|
||||
<property name="use_underline">False</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.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -350,8 +390,8 @@
|
|||
<child>
|
||||
<widget class="GtkFrame" id="frame6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Cursor Theme</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
|
@ -365,12 +405,13 @@
|
|||
<widget class="GtkFrame" id="frame7">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="cursor_tree">
|
||||
<property name="visible">True</property>
|
||||
<property name="headers_visible">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>
|
||||
|
@ -412,6 +453,25 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Cursor Theme</property>
|
||||
<property name="use_underline">False</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.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -423,8 +483,8 @@
|
|||
<child>
|
||||
<widget class="GtkFrame" id="locate_pointer_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Locate Pointer</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
|
@ -480,6 +540,25 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Locate Pointer</property>
|
||||
<property name="use_underline">False</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.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -523,8 +602,8 @@
|
|||
<child>
|
||||
<widget class="GtkFrame" id="frame3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Speed</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
|
@ -658,6 +737,7 @@
|
|||
<property name="inverted">False</property>
|
||||
<property name="adjustment">1 1 10 1 1 0</property>
|
||||
<accessibility>
|
||||
<atkrelation target="speed_label" type="labelled-by"/>
|
||||
<atkrelation target="low_label" type="labelled-by"/>
|
||||
<atkrelation target="high_label" type="labelled-by"/>
|
||||
</accessibility>
|
||||
|
@ -680,8 +760,9 @@
|
|||
<property name="digits">1</property>
|
||||
<property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
|
||||
<property name="inverted">False</property>
|
||||
<property name="adjustment">1 1 10 1 1 0</property>
|
||||
<property name="adjustment">6 1 10 1 1 0</property>
|
||||
<accessibility>
|
||||
<atkrelation target="speed_label" type="labelled-by"/>
|
||||
<atkrelation target="slow_label" type="labelled-by"/>
|
||||
<atkrelation target="fast_label" type="labelled-by"/>
|
||||
</accessibility>
|
||||
|
@ -783,6 +864,25 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Speed</property>
|
||||
<property name="use_underline">False</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.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -794,8 +894,8 @@
|
|||
<child>
|
||||
<widget class="GtkFrame" id="frame5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Drag and Drop</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
|
@ -936,6 +1036,25 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Drag and Drop</property>
|
||||
<property name="use_underline">False</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.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue