add the <center> option for placing windows
authorDana Jansens <danakj@orodu.net>
Thu, 19 Jul 2007 21:24:59 +0000 (17:24 -0400)
committerDana Jansens <danakj@orodu.net>
Sun, 22 Jul 2007 19:38:30 +0000 (15:38 -0400)
src/obconf.glade
src/strings.c
src/windows.c

index c176997..83a8e38 100644 (file)
@@ -1266,6 +1266,26 @@ C - The close button</property>
                              <property name="fill">False</property>
                            </packing>
                          </child>
+
+                         <child>
+                           <widget class="GtkCheckButton" id="place_center">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="label" translatable="yes">_Center new windows when they are placed</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_place_center_toggled" after="yes" last_modification_time="Thu, 19 Jul 2007 21:21:23 GMT"/>
+                           </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>
index 8faceb4..7ff2733 100644 (file)
@@ -38,6 +38,7 @@ gchar *s = N_("Focus _new windows when they appear");
 gchar *s = N_("<span weight=\"bold\">Placing Windows</span>");
 gchar *s = N_("    ");
 gchar *s = N_("_Place new windows under the mouse pointer");
+gchar *s = N_("_Center new windows when they are placed");
 gchar *s = N_("<span weight=\"bold\">Moving and Resizing Windows</span>");
 gchar *s = N_("    ");
 gchar *s = N_("Update the window contents while _resizing");
index 54bd391..f81cec4 100644 (file)
@@ -79,6 +79,10 @@ void windows_setup_tab()
                                  !g_ascii_strcasecmp(s, "UnderMouse"));
     g_free(s);
 
+    w = get_widget("place_center");
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
+                                 tree_get_bool("placement/center", TRUE));
+
     w = get_widget("resize_popup");
     s = tree_get_string("resize/popupShow", "NonPixel");
     if (!strcasecmp(s, "Always"))     pos = POPUP_ALWAYS;
@@ -113,6 +117,12 @@ static void enable_stuff()
 
     w = get_widget("resize_position");
     gtk_widget_set_sensitive(w, b);
+
+    w = get_widget("place_mouse");
+    b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
+
+    w = get_widget("place_center");
+    gtk_widget_set_sensitive(w, !b);
 }
 
 void on_focus_new_toggled(GtkToggleButton *w, gpointer data)
@@ -129,6 +139,14 @@ void on_place_mouse_toggled(GtkToggleButton *w, gpointer data)
     tree_set_string("placement/policy",
                     (gtk_toggle_button_get_active(w) ?
                      "UnderMouse" : "Smart"));
+    enable_stuff();
+}
+
+void on_place_center_toggled(GtkToggleButton *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_bool("placement/center", gtk_toggle_button_get_active(w));
 }
 
 void on_resist_window_value_changed(GtkSpinButton *w, gpointer data)