additional patch for vertical panels



Hi,

this is an additional patch for my tasklist changes which makes the 
vertical panels work in a sensible way.  It doesn't change the UI and uses 
the minimum and maximum size preferences in the same way as the horizontal 
case.

The only thing that doesn't work right now is when you move a panel to a 
different orientation and then try to change the size.  I will look into 
this further.

Is it ok for me to commit this to CVS ?

Thanks,
Thomas

-- 

The Dave/Dina Project : future TV today ! - http://davedina.apestaart.org/
<-*-                      -*->
- I didn't say I wanted you out of my life.
  It's just...with the ironing, the new mattress,
  they all just seem like things that are a little further
  down the line, that's all.
- Further down the line than all the sex we've been having?
<-*- thomas apestaart org -*->
URGent, the best radio on the Internet - 24/7 ! - http://urgent.rug.ac.be/
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libwnck/ChangeLog,v
retrieving revision 1.112
diff -u -p -r1.112 ChangeLog
--- ChangeLog	13 May 2002 02:33:14 -0000	1.112
+++ ChangeLog	13 May 2002 20:22:16 -0000
@@ -1,3 +1,7 @@
+2002-05-13  Thomas Vander Stichele <thomas apestaart org>
+
+  	* libwnck/taslist.c: implemented minimum_height 
+
 2002-05-11  Thomas Vander Stichele <thomas apestaart org>
  
         * libwnck/tasklist.c: implemented minimum_width 
Index: libwnck/tasklist.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/tasklist.c,v
retrieving revision 1.33
diff -u -p -r1.33 tasklist.c
--- libwnck/tasklist.c	13 May 2002 02:33:17 -0000	1.33
+++ libwnck/tasklist.c	13 May 2002 20:22:21 -0000
@@ -67,7 +67,7 @@ struct _WnckTask
   GtkWidget *image;
   GtkWidget *label;
   
-  gboolean is_application;
+  gboolean is_application; /* TRUE if this task is a grouped application */
   WnckApplication *application;
   WnckWindow *window;
 
@@ -125,6 +125,7 @@ struct _WnckTasklistPrivate
   int size_hints_len;
 
   gint minimum_width;
+  gint minimum_height;
 };
 
 
@@ -364,6 +365,7 @@ wnck_tasklist_init (WnckTasklist *taskli
   tasklist->priv->grouping_limit = DEFAULT_GROUPING_LIMIT;
 
   tasklist->priv->minimum_width = DEFAULT_WIDTH;
+  tasklist->priv->minimum_height = DEFAULT_HEIGHT;
 }
 
 static void
@@ -496,6 +498,28 @@ wnck_tasklist_get_minimum_width (WnckTas
   return tasklist->priv->minimum_width;
 }
 
+/* set the minimum height */
+void 
+wnck_tasklist_set_minimum_height (WnckTasklist *tasklist, gint size)
+{
+  g_return_if_fail (WNCK_IS_TASKLIST (tasklist));
+
+  if (tasklist->priv->minimum_height == size)
+    return;
+
+  tasklist->priv->minimum_height = size;
+  gtk_widget_queue_resize (GTK_WIDGET (tasklist));
+}
+ 
+/* get the minimum height */
+gint
+wnck_tasklist_get_minimum_height (WnckTasklist *tasklist)
+{
+  g_return_val_if_fail (WNCK_IS_TASKLIST (tasklist), 0);
+	
+  return tasklist->priv->minimum_height;
+}
+
 /* returns the maximal possible button width (i.e. if you
  * don't want to stretch the buttons to fill the alloctions
  * the width can be smaller) */
@@ -672,7 +696,7 @@ wnck_tasklist_size_request  (GtkWidget  
   gtk_widget_get_size_request (widget, &u_width, &u_height);
 
   requisition->width = tasklist->priv->minimum_width;
-  requisition->height = DEFAULT_HEIGHT;
+  requisition->height = tasklist->priv->minimum_height;
   
   if (u_height != -1)
     {
Index: libwnck/tasklist.h
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/tasklist.h,v
retrieving revision 1.8
diff -u -p -r1.8 tasklist.h
--- libwnck/tasklist.h	13 May 2002 02:33:17 -0000	1.8
+++ libwnck/tasklist.h	13 May 2002 20:22:21 -0000
@@ -73,6 +73,8 @@ void wnck_tasklist_set_include_all_works
 					       gboolean      include_all_workspaces);
 void wnck_tasklist_set_minimum_width (WnckTasklist *tasklist, gint size);
 gint wnck_tasklist_get_minimum_width (WnckTasklist *tasklist);
+void wnck_tasklist_set_minimum_height (WnckTasklist *tasklist, gint size);
+gint wnck_tasklist_get_minimum_height (WnckTasklist *tasklist);
     
 G_END_DECLS
 
Index: applets/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/ChangeLog,v
retrieving revision 1.301
diff -u -p -r1.301 ChangeLog
--- applets/ChangeLog	13 May 2002 10:02:56 -0000	1.301
+++ applets/ChangeLog	13 May 2002 20:23:09 -0000
@@ -1,3 +1,8 @@
+2002-05-13  Thomas Vander Stichele <thomas apestaart org>
+
+  	* applets/gen_util/tasklist.c: fixed minimum_size and maximum_size
+	  for vertical panels 
+
 2002-05-11  Thomas Vander Stichele <thomas apestaart org>
 
         * applets/gen_util/tasklist.c: implemented minimum_size and 
Index: applets/gen_util/tasklist.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/gen_util/tasklist.c,v
retrieving revision 1.29
diff -u -p -r1.29 tasklist.c
--- applets/gen_util/tasklist.c	13 May 2002 10:02:57 -0000	1.29
+++ applets/gen_util/tasklist.c	13 May 2002 20:23:12 -0000
@@ -340,7 +340,10 @@ minimum_size_changed (GConfClient *clien
 	value = gconf_value_get_int (entry->value);
 	
 	gtk_spin_button_set_value (button, value);
-	wnck_tasklist_set_minimum_width (wncktl, value);
+	if (tasklist->orientation == GTK_ORIENTATION_HORIZONTAL)
+		wnck_tasklist_set_minimum_width (wncktl, value);
+	else
+		wnck_tasklist_set_minimum_height (wncktl, value);
 }
 
 /* GConf callback for changes in maximum_size */
@@ -417,14 +420,19 @@ applet_size_request (GtkWidget      *wid
 	const int *size_hints;
 	GtkRequisition child_req;
 	int i;
-	int maximum_width;
+	int maximum_size;
 	int *new_size_hints;
 	int new_len = 0;
     	WnckTasklist *wncktl = WNCK_TASKLIST (tasklist->tasklist);
-	gint minimum_width = wnck_tasklist_get_minimum_width (wncktl);
+	gint minimum_size = 0;
+	
+	
+	if (tasklist->orientation == GTK_ORIENTATION_HORIZONTAL)
+		minimum_size = wnck_tasklist_get_minimum_width (wncktl);
+	else
+		minimum_size = wnck_tasklist_get_minimum_height (wncktl);
 	
-	gtk_widget_get_child_requisition (tasklist->applet,
-					  &child_req);
+	gtk_widget_get_child_requisition (tasklist->applet, &child_req);
 	
 	size_hints = wnck_tasklist_get_size_hint_list (wncktl, &len);
 	new_size_hints = g_new0 (int, len);
@@ -433,14 +441,14 @@ applet_size_request (GtkWidget      *wid
 	 * where min(i) > max (i+1)
 	 * convert it to clipped values
 	 */
-	maximum_width = tasklist->maximum_size - minimum_width;
-	g_assert (maximum_width >= 0);
+	maximum_size = tasklist->maximum_size - minimum_size;
+	g_assert (maximum_size >= 0);
 
 	for (i = 0; i < len; i += 2) {
-		if (size_hints[i + 1] <= maximum_width) {
+		if (size_hints[i + 1] <= maximum_size) {
 		        /* this one should be stored */
-			if (size_hints[i] > maximum_width)
-			    	new_size_hints[new_len] = maximum_width;
+			if (size_hints[i] > maximum_size)
+			    	new_size_hints[new_len] = maximum_size;
 			else
 				new_size_hints[new_len] = size_hints[i];
 			new_size_hints[new_len + 1] = size_hints[i + 1];
@@ -521,9 +529,12 @@ fill_tasklist_applet(PanelApplet *applet
 	error = NULL;
 	sizepref = panel_applet_gconf_get_int (applet, "minimum_size", 
 					       &error);
-        if (error == NULL) 
-		wnck_tasklist_set_minimum_width (WNCK_TASKLIST (tasklist->tasklist), 
-						 sizepref);	  
+        if (error == NULL) {
+		if (tasklist->orientation == GTK_ORIENTATION_HORIZONTAL)
+			wnck_tasklist_set_minimum_width (WNCK_TASKLIST (tasklist->tasklist), sizepref);	  
+		else
+			wnck_tasklist_set_minimum_height (WNCK_TASKLIST (tasklist->tasklist), sizepref);	  
+	}
 	else
 		g_error_free (error);
 
@@ -685,10 +696,10 @@ spin_minimum_size_changed (GtkSpinButton
 	GtkSpinButton *max_b = GTK_SPIN_BUTTON (tasklist->maximum_size_spin);
 	PanelApplet *applet = PANEL_APPLET (tasklist->applet);
 	gint prop_value = gtk_spin_button_get_value (button);
-	gint max_width = gtk_spin_button_get_value (max_b);
+	gint max_size = gtk_spin_button_get_value (max_b);
 	
 	/* check if we exceed max width */
-	if (prop_value > max_width)
+	if (prop_value > max_size)
 	        panel_applet_gconf_set_int (applet, "maximum_size", 
 			                    prop_value, NULL);
 	panel_applet_gconf_set_int (applet, "minimum_size", prop_value, NULL);
@@ -704,10 +715,10 @@ spin_maximum_size_changed (GtkSpinButton
 	GtkSpinButton *min_b = GTK_SPIN_BUTTON (tasklist->minimum_size_spin);
 	PanelApplet *applet = PANEL_APPLET (tasklist->applet);
 	gint prop_value = gtk_spin_button_get_value (button);
-	gint min_width = gtk_spin_button_get_value (min_b);
+	gint min_size = gtk_spin_button_get_value (min_b);
 
 	/* check if we drop below min width */
-	if (prop_value < min_width)
+	if (prop_value < min_size)
 		panel_applet_gconf_set_int (applet, "minimum_size", 
 					    prop_value, NULL);
 	panel_applet_gconf_set_int (applet, "maximum_size", prop_value, NULL);


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