From 1fcf33ba44174679fbda2773130bb73d7f4cfb3a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 4 Aug 2007 12:05:46 -0400 Subject: [PATCH] add option for showing the desktop change popup notification --- src/desktops.c | 46 +++++++++++++++ src/obconf.glade | 144 ++++++++++++++++++++++++++++++++++++++++++++++- src/strings.c | 4 ++ 3 files changed, 193 insertions(+), 1 deletion(-) diff --git a/src/desktops.c b/src/desktops.c index b45faa4..d7e9811 100644 --- a/src/desktops.c +++ b/src/desktops.c @@ -36,12 +36,14 @@ static void on_desktop_names_cell_edited(GtkCellRendererText *cell, const gchar *path_string, const gchar *new_text, gpointer data); +static void enable_stuff(); void desktops_setup_tab() { GtkWidget *w; GtkCellRenderer *render; GtkTreeViewColumn *column; + gint i; mapping = TRUE; @@ -68,9 +70,30 @@ void desktops_setup_tab() desktops_read_names(); + i = tree_get_int("desktops/popupTime", 875); + + w = get_widget("desktop_popup"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), i != 0); + + w = get_widget("desktop_popup_time"); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), i ? i : 875); + + enable_stuff(); + mapping = FALSE; } +static void enable_stuff() +{ + GtkWidget *w; + gboolean b; + + w = get_widget("desktop_popup"); + b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); + w = get_widget("desktop_popup_time"); + gtk_widget_set_sensitive(w, b); +} + void on_desktop_num_value_changed(GtkSpinButton *w, gpointer data) { if (mapping) return; @@ -214,3 +237,26 @@ static void desktops_write_number() SubstructureNotifyMask | SubstructureRedirectMask, &ce); } + +void on_desktop_popup_toggled(GtkToggleButton *w, gpointer data) +{ + if (mapping) return; + + if (gtk_toggle_button_get_active(w)) { + GtkWidget *w2; + + w2 = get_widget("desktop_popup_time"); + tree_set_int("desktops/popupTime", + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w2))); + } + else + tree_set_int("desktops/popupTime", 0); + enable_stuff(); +} + +void on_desktop_popup_time_value_changed(GtkSpinButton *w, gpointer data) +{ + if (mapping) return; + + tree_set_int("desktops/popupTime", gtk_spin_button_get_value_as_int(w)); +} diff --git a/src/obconf.glade b/src/obconf.glade index 000d2a4..3aed41d 100644 --- a/src/obconf.glade +++ b/src/obconf.glade @@ -1982,7 +1982,7 @@ C - The close button 0 - True + False True @@ -2860,6 +2860,148 @@ C - The close button True + + + + True + True + _Show a notification when you switch desktops + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + 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 + 6 + + + + True + _Amount of time to wait before switching: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + desktop_popup_time + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 0 1 10000 10 10 10 + + + + 0 + False + True + + + + + + True + ms + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + False + True + + 0 diff --git a/src/strings.c b/src/strings.c index 3b086d5..10bb7af 100644 --- a/src/strings.c +++ b/src/strings.c @@ -83,6 +83,10 @@ gchar *s = N_("Desktops"); gchar *s = N_(" "); gchar *s = N_("_Number of desktops: "); gchar *s = N_("_Desktop names:"); +gchar *s = N_("_Show a notification when you switch desktops"); +gchar *s = N_(" "); +gchar *s = N_("_Amount of time to wait before switching:"); +gchar *s = N_("ms"); gchar *s = N_("Desktops"); gchar *s = N_("Desktop Margins"); gchar *s = N_(" "); -- 2.39.2