Re: Patch to gnome-pager



On Tue, May 25, 1999 at 11:13:08AM -0500, Miguel de Icaza wrote:
> 
> > In the faq it says or used to say to send patches to the list and you
> > will then be assigned a leason programmer to review future patches
> > untill you are given CVS write access...
> 
> Can you CC it to gnome-hackers and raster@redhat.com?
> 
> -- 
> miguel@gnu.org
> 

Ok, here is my mail from a while back...

-----------------------------

Hello,

For some time I've been using gnome-pager in a corner panel all for itself,
with the panel being in the top-right corner. In such a configuration
the pager box moves to the left or right whenever you click on it
(because the window list gets either larger or shorter). This is a
little irritating when trying to zap through the desktops.

The obvious way to solve this, is to make the pager box and the task list
box switch places. That way, the pager box is in the corner (in my
configuration) and its position is independent of the task list.

This is so easy to implement that I did it myself. I include the
patch here. I added a rightbutton menu item called 'switch' that
does the trick. 'switch' is not very descriptive, and I guess
this should really go under Properties, but there isn't really a
good place for this in the properties dialog, and it's easier
to reach in this way. So I'm not sure what's right.

One thing I noticed about the gnome-pager applet is that the properties
are not saved when you remove the applet and put it back again.

Ronald

Index: gnomepager.h
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/gnome-pager/gnomepager.h,v
retrieving revision 1.16
diff -u -r1.16 gnomepager.h
--- gnomepager.h	1999/04/23 02:02:07	1.16
+++ gnomepager.h	1999/05/06 19:17:22
@@ -43,6 +43,7 @@
 void cb_applet_about(AppletWidget * widget, gpointer data);
 void cb_prop_apply(GtkWidget *widget, int page, gpointer data);
 void cb_applet_properties(AppletWidget * widget, gpointer data);
+void cb_switch(GtkWidget *w, gpointer data);
 
 void *util_get_atom(Window win, gchar *atom, Atom type, gint *size);
 
Index: gnomepager_applet.c
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/gnome-pager/gnomepager_applet.c,v
retrieving revision 1.70
diff -u -r1.70 gnomepager_applet.c
--- gnomepager_applet.c	1999/05/01 18:56:54	1.70
+++ gnomepager_applet.c	1999/05/06 19:17:28
@@ -41,6 +41,7 @@
 	gint                fixed_tasklist; /*bool*/
 	gint                pager_w_0, pager_h_0;
 	gint                pager_w_1, pager_h_1;
+	gboolean	    left_to_right;
 } Config;
 
 /*note: no need for defaults as they will be read in*/
@@ -120,6 +121,13 @@
   gtk_widget_show(w);
 }
 
+void
+cb_switch(GtkWidget *w, gpointer data)
+{
+  config.left_to_right=!config.left_to_right;
+  redo_interface();
+  gtk_widget_show(w);
+}
 
 void 
 cb_applet_about(AppletWidget * widget, gpointer data)
@@ -1413,6 +1421,7 @@
   gnome_config_set_int("stuff/pager_h_0", config.pager_h_0);
   gnome_config_set_int("stuff/pager_w_1", config.pager_w_1);
   gnome_config_set_int("stuff/pager_h_1", config.pager_h_1);
+  gnome_config_set_bool("stuff/left_to_right", config.left_to_right);
   gnome_config_pop_prefix();
   gnome_config_sync();
   gnome_config_drop_all();
@@ -1497,6 +1506,7 @@
   config.pager_h_0 = gnome_config_get_int("gnome_pager/stuff/pager_h_0=22");
   config.pager_w_1 = gnome_config_get_int("gnome_pager/stuff/pager_w_1=62");
   config.pager_h_1 = gnome_config_get_int("gnome_pager/stuff/pager_h_1=44");
+  config.left_to_right = gnome_config_get_bool("gnome_pager/stuff/left_to_right=true");
 
   /*make sure these are not done next time*/
   gnome_config_clean_file("gnome_pager");
@@ -1556,6 +1566,11 @@
 					_("Properties..."),
 					cb_applet_properties,
 					NULL);
+  applet_widget_register_callback(APPLET_WIDGET(applet),
+					"switch",
+					_("Switch"),
+					(AppletCallbackFunc)cb_switch,
+					hold_box);
 
   /*this really loads the correct data*/
   gnome_config_push_prefix(APPLET_WIDGET(applet)->privcfgpath);
@@ -2081,8 +2096,11 @@
   align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
   if (config.show_pager)
     gtk_widget_show(align);
-  gtk_box_pack_start(GTK_BOX(main_box), align, FALSE, FALSE, 0);
-  
+  if (config.left_to_right)
+    gtk_box_pack_start(GTK_BOX(main_box), align, FALSE, FALSE, 0);
+  else
+    gtk_box_pack_end(GTK_BOX(main_box), align, FALSE, FALSE, 0);
+
   frame = gtk_frame_new(NULL);
   gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
   gtk_widget_show(frame);
@@ -2153,11 +2171,17 @@
      gtk_widget_show(arrow);
      gtk_container_add(GTK_CONTAINER(arrow_button), arrow);
 
-     gtk_box_pack_start(GTK_BOX(main_box), box, FALSE, FALSE, 0);
+     if (config.left_to_right)
+       gtk_box_pack_start(GTK_BOX(main_box), box, FALSE, FALSE, 0);
+     else
+       gtk_box_pack_end(GTK_BOX(main_box), box, FALSE, FALSE, 0);
     }
   
   frame = gtk_frame_new(NULL);
-  gtk_box_pack_start(GTK_BOX(main_box), frame, FALSE, FALSE, 0);
+  if (config.left_to_right)
+    gtk_box_pack_start(GTK_BOX(main_box), frame, FALSE, FALSE, 0);
+  else
+    gtk_box_pack_end(GTK_BOX(main_box), frame, FALSE, FALSE, 0);
   gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
   if (config.show_tasks)
     gtk_widget_show(frame);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]