add option for showing the desktop change popup notification
authorDana Jansens <danakj@orodu.net>
Sat, 4 Aug 2007 16:05:46 +0000 (12:05 -0400)
committerDana Jansens <danakj@orodu.net>
Sat, 4 Aug 2007 16:05:46 +0000 (12:05 -0400)
src/desktops.c
src/obconf.glade
src/strings.c

index b45faa4..d7e9811 100644 (file)
@@ -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));
+}
index 000d2a4..3aed41d 100644 (file)
@@ -1982,7 +1982,7 @@ C - The close button</property>
                            </widget>
                            <packing>
                              <property name="padding">0</property>
-                             <property name="expand">True</property>
+                             <property name="expand">False</property>
                              <property name="fill">True</property>
                            </packing>
                          </child>
@@ -2860,6 +2860,148 @@ C - The close button</property>
                          <property name="fill">True</property>
                        </packing>
                      </child>
+
+                     <child>
+                       <widget class="GtkCheckButton" id="desktop_popup">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="label" translatable="yes">_Show a notification when you switch desktops</property>
+                         <property name="use_underline">True</property>
+                         <property name="relief">GTK_RELIEF_NORMAL</property>
+                         <property name="focus_on_click">True</property>
+                         <property name="active">False</property>
+                         <property name="inconsistent">False</property>
+                         <property name="draw_indicator">True</property>
+                         <signal name="toggled" handler="on_desktop_popup_toggled" after="yes" last_modification_time="Sat, 04 Aug 2007 15:57:40 GMT"/>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkHBox" id="hbox105">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">0</property>
+
+                         <child>
+                           <widget class="GtkLabel" id="label217">
+                             <property name="visible">True</property>
+                             <property name="label">    </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>
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkHBox" id="hbox106">
+                             <property name="visible">True</property>
+                             <property name="homogeneous">False</property>
+                             <property name="spacing">6</property>
+
+                             <child>
+                               <widget class="GtkLabel" id="label218">
+                                 <property name="visible">True</property>
+                                 <property name="label" translatable="yes">_Amount of time to wait before switching:</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">desktop_popup_time</property>
+                                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</property>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">False</property>
+                                 <property name="fill">False</property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkSpinButton" id="desktop_popup_time">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">True</property>
+                                 <property name="climb_rate">1</property>
+                                 <property name="digits">0</property>
+                                 <property name="numeric">True</property>
+                                 <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+                                 <property name="snap_to_ticks">False</property>
+                                 <property name="wrap">False</property>
+                                 <property name="adjustment">0 1 10000 10 10 10</property>
+                                 <signal name="value_changed" handler="on_desktop_popup_time_value_changed" after="yes" last_modification_time="Sat, 04 Aug 2007 16:03:27 GMT"/>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">False</property>
+                                 <property name="fill">True</property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkLabel" id="label219">
+                                 <property name="visible">True</property>
+                                 <property name="label" translatable="yes">ms</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>
+                                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</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>
+                             <property name="expand">True</property>
+                             <property name="fill">True</property>
+                           </packing>
+                         </child>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">False</property>
+                         <property name="fill">True</property>
+                       </packing>
+                     </child>
                    </widget>
                    <packing>
                      <property name="padding">0</property>
index 3b086d5..10bb7af 100644 (file)
@@ -83,6 +83,10 @@ gchar *s = N_("<span weight=\"bold\">Desktops</span>");
 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_("<span weight=\"bold\">Desktop Margins</span>");
 gchar *s = N_("    ");