From 645f460ba5278bbc0d766dcd060076e50b08a9f0 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 1 Jun 2007 02:32:36 +0000 Subject: [PATCH] add the popupPosition option --- src/obconf.glade | 115 ++++++++++++++++++++++++++++++++++++++++++++++- src/strings.c | 4 ++ src/windows.c | 47 +++++++++++++++++++ 3 files changed, 165 insertions(+), 1 deletion(-) diff --git a/src/obconf.glade b/src/obconf.glade index e5bacef..d104408 100644 --- a/src/obconf.glade +++ b/src/obconf.glade @@ -1266,7 +1266,7 @@ C - The close button 0 - + True False @@ -1400,6 +1400,119 @@ C - The close button + + + True + False + 0 + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + 12 + + + + True + Size _dialog's position + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + dock_position + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + 0 + + + + + + + True + Centered on the window + True + + + + + + + True + Above the window + True + + + + + + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + True diff --git a/src/strings.c b/src/strings.c index da6cfc4..492c031 100644 --- a/src/strings.c +++ b/src/strings.c @@ -44,6 +44,10 @@ gchar *s = N_("_Show size dialog:"); gchar *s = N_("When resizing terminal windows"); gchar *s = N_("Always"); gchar *s = N_("Never"); +gchar *s = N_(" "); +gchar *s = N_("Size _dialog's position"); +gchar *s = N_("Centered on the window"); +gchar *s = N_("Above the window"); gchar *s = N_("Drag _threshold distance:"); gchar *s = N_("px"); gchar *s = N_("Amount of resistance against other _windows:"); diff --git a/src/windows.c b/src/windows.c index 6a0bbab..54bd391 100644 --- a/src/windows.c +++ b/src/windows.c @@ -26,6 +26,11 @@ static gboolean mapping = FALSE; #define POPUP_ALWAYS 1 #define POPUP_NEVER 2 +#define POSITION_CENTER 0 +#define POSITION_TOP 1 + +static void enable_stuff(); + void windows_setup_tab() { GtkWidget *w, *w1, *w2, *w3; @@ -86,9 +91,30 @@ void windows_setup_tab() gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), tree_get_int("mouse/dragThreshold", 8)); + w = get_widget("resize_position"); + s = tree_get_string("resize/popupPosition", "Center"); + if (!strcasecmp(s, "Top")) pos = POSITION_TOP; + else pos = POSITION_CENTER; + g_free(s); + gtk_option_menu_set_history(GTK_OPTION_MENU(w), pos); + + enable_stuff(); + mapping = FALSE; } +static void enable_stuff() +{ + GtkWidget *w; + gboolean b; + + w = get_widget("resize_popup"); + b = gtk_option_menu_get_history(GTK_OPTION_MENU(w)) != POPUP_NEVER; + + w = get_widget("resize_position"); + gtk_widget_set_sensitive(w, b); +} + void on_focus_new_toggled(GtkToggleButton *w, gpointer data) { if (mapping) return; @@ -132,6 +158,7 @@ void on_resize_popup_nonpixel_activate(GtkMenuItem *w, gpointer data) if (mapping) return; tree_set_string("resize/popupShow", "NonPixel"); + enable_stuff(); } void on_resize_popup_always_activate(GtkMenuItem *w, gpointer data) @@ -139,6 +166,7 @@ void on_resize_popup_always_activate(GtkMenuItem *w, gpointer data) if (mapping) return; tree_set_string("resize/popupShow", "Always"); + enable_stuff(); } void on_resize_popup_never_activate(GtkMenuItem *w, gpointer data) @@ -146,6 +174,7 @@ void on_resize_popup_never_activate(GtkMenuItem *w, gpointer data) if (mapping) return; tree_set_string("resize/popupShow", "Never"); + enable_stuff(); } void on_drag_threshold_value_changed(GtkSpinButton *w, gpointer data) @@ -155,3 +184,21 @@ void on_drag_threshold_value_changed(GtkSpinButton *w, gpointer data) tree_set_int("mouse/dragThreshold", gtk_spin_button_get_value_as_int(w)); } + +void on_resize_position_center_activate(GtkMenuItem *w, gpointer data) +{ + if (mapping) return; + + tree_set_string("resize/popupPosition", "Center"); + enable_stuff(); +} + + +void on_resize_position_top_activate(GtkMenuItem *w, gpointer data) +{ + if (mapping) return; + + tree_set_string("resize/popupPosition", "Top"); + enable_stuff(); +} + -- 2.39.2