quick-lounge-applet r239 - in trunk: . data/ui src



Author: paobac
Date: Mon Feb  2 15:27:27 2009
New Revision: 239
URL: http://svn.gnome.org/viewvc/quick-lounge-applet?rev=239&view=rev

Log:
2009-02-02  Paolo Bacchilega  <paobac svn gnome org>

	* src/quick-box.c: 
	
	do not include the arrow to the size request.
	
	* src/quick-lounge.h: 
	* src/quick-lounge.c: 
	* src/dlg-properties.c: 
	
	Update the min value if the max value is smaller and vice versa.
	
	* data/ui/properties.ui: assign an adjustement to the spinbuttons 


Modified:
   trunk/ChangeLog
   trunk/data/ui/properties.ui
   trunk/src/dlg-properties.c
   trunk/src/quick-box.c
   trunk/src/quick-lounge.c
   trunk/src/quick-lounge.h

Modified: trunk/data/ui/properties.ui
==============================================================================
--- trunk/data/ui/properties.ui	(original)
+++ trunk/data/ui/properties.ui	Mon Feb  2 15:27:27 2009
@@ -419,7 +419,10 @@
                                       <object class="GtkSpinButton" id="p_minsize_spinbutton">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
+                                        <property name="progress_fraction">0.059999999999999998</property>
+                                        <property name="adjustment">minsize_adjustment</property>
                                         <property name="climb_rate">1</property>
+                                        <property name="numeric">True</property>
                                       </object>
                                       <packing>
                                         <property name="position">0</property>
@@ -463,6 +466,7 @@
                                       <object class="GtkSpinButton" id="p_maxsize_spinbutton">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
+                                        <property name="adjustment">maxsize_adjustment</property>
                                         <property name="climb_rate">1</property>
                                       </object>
                                       <packing>
@@ -617,4 +621,16 @@
       <action-widget response="0">p_close_button</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkAdjustment" id="minsize_adjustment">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+    <property name="page_size">10</property>
+  </object>
+  <object class="GtkAdjustment" id="maxsize_adjustment">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+    <property name="page_size">10</property>
+  </object>
 </interface>

Modified: trunk/src/dlg-properties.c
==============================================================================
--- trunk/src/dlg-properties.c	(original)
+++ trunk/src/dlg-properties.c	Mon Feb  2 15:27:27 2009
@@ -108,13 +108,16 @@
 change_max_size (gpointer user_data)
 {
 	DialogData *data = user_data;
-
+	gboolean    needs_update;
+	
 	g_source_remove (data->timeout);
 	data->timeout = 0;
 
-	quick_lounge_set_max_size (data->quick_lounge, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (data->p_maxsize_spinbutton)));
+	needs_update = quick_lounge_set_max_size (data->quick_lounge, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (data->p_maxsize_spinbutton)));
 	gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->p_maxsize_spinbutton), quick_box_get_max_visible_cols (data->quick_box));
-
+	if (needs_update)
+		gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->p_minsize_spinbutton), quick_box_get_min_visible_cols (data->quick_box));
+		
 	return FALSE;
 }
 
@@ -641,8 +644,12 @@
 min_size_value_changed_cb (GtkWidget  *widget,
 			   DialogData *data)
 {
-	quick_lounge_set_min_visible_cols (data->quick_lounge, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (data->p_minsize_spinbutton)));
+	gboolean needs_update;
+	
+	needs_update =quick_lounge_set_min_visible_cols (data->quick_lounge, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (data->p_minsize_spinbutton)));	 
 	gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->p_minsize_spinbutton), quick_box_get_min_visible_cols (data->quick_box));
+	if (needs_update)
+		gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->p_maxsize_spinbutton), quick_box_get_max_visible_cols(data->quick_box));
 }
 
 

Modified: trunk/src/quick-box.c
==============================================================================
--- trunk/src/quick-box.c	(original)
+++ trunk/src/quick-box.c	Mon Feb  2 15:27:27 2009
@@ -68,7 +68,7 @@
 	int                min_visible_cols;
 	int                max_visible_cols;
 	int                size_hint[2];
-
+	
 	int                drag_pos_begin;
 	int                drag_pos;
 	GtkWidget         *popup_menu;
@@ -234,8 +234,8 @@
 			max_column_width = 0;
 			col++;
 			row = 1;
-
-		} else if ((orientation == GTK_ORIENTATION_HORIZONTAL)
+		} 
+		else if ((orientation == GTK_ORIENTATION_HORIZONTAL)
 			   && QUICK_IS_BUTTON (child_widget)) {
 
 			max_column_width = MAX (max_column_width, 
@@ -253,8 +253,8 @@
 				col++;
 				row = 1;
 			} 
-			
-		} else if ((orientation == GTK_ORIENTATION_VERTICAL)
+		} 
+		else if ((orientation == GTK_ORIENTATION_VERTICAL)
 			   && QUICK_IS_SEPARATOR (child_widget)) {
 			
 			if (max_column_height != 0) {
@@ -280,8 +280,8 @@
 			max_column_height = 0;
 			row++;
 			col = 1;
-
-		} else if ((orientation == GTK_ORIENTATION_VERTICAL)
+		} 
+		else if ((orientation == GTK_ORIENTATION_VERTICAL)
 			   && QUICK_IS_BUTTON (child_widget)) {
 			
 			max_column_height = MAX (max_column_height, 
@@ -308,7 +308,8 @@
 			p->buttons_on_col[col - 1] = row - 1;
 			cur_size += p->col_size[col - 1];
 		}
-	} else {
+	} 
+	else {
 		if (max_column_height != 0) {
 			p->col_size[row - 1] = max_column_height + spacing;
 			p->buttons_on_col[row - 1] = col - 1;
@@ -321,7 +322,8 @@
 			min_size = cur_size;
 		if (col <= max_columns)
 			max_size = cur_size;
-	} else {
+	} 
+	else {
 		if (row <= min_columns)
 			min_size = cur_size;
 		if (row <= max_columns)
@@ -351,7 +353,8 @@
 		requisition->width = min_size;
 		requisition->height = MAX (p->size, arrow_height);
 		p->size_hint[SIZE_HINT_MAX] = max_size - requisition->width;
-	} else {
+	} 
+	else {
 		int last_row = row;
 		if (col == 1)
 			last_row--;
@@ -375,12 +378,13 @@
 	p->size_hint[SIZE_HINT_MIN] = 0;
 
 	/* FIXME */
-	if (! GTK_WIDGET_VISIBLE (arrow)) {
+	/*if (! GTK_WIDGET_VISIBLE (arrow)) {*/
 		if (orientation == GTK_ORIENTATION_HORIZONTAL)
 			p->size_hint[SIZE_HINT_MAX] -= spacing + arrow_width;
 		else
 			p->size_hint[SIZE_HINT_MAX] -= spacing + arrow_height;
-	}
+	/*}*/
+	
 	/**/
 
 	g_list_free (children);
@@ -391,7 +395,7 @@
 	requisition->height += GTK_CONTAINER (box)->border_width * 2;
 
 #ifdef DEBUG
-        g_print ("REQ [%d, %d]", requisition->width, requisition->height);
+        g_print ("REQ [%d, %d]\n", requisition->width, requisition->height);
 #endif
 }
 
@@ -472,18 +476,17 @@
 children_under_the_arrow (QuickBox *quick_box,
 			  int       arrow_size)
 {
-	QuickBoxPrivate *priv = quick_box->priv;
-	int i, c;
 	int n_buttons = 0;
+	int i, c;
 
-	for (c = priv->columns - 1; c >= 0; c--) {
-		arrow_size -= priv->col_size[c];
+	for (c = quick_box->priv->columns - 1; c >= 0; c--) {
+		arrow_size -= quick_box->priv->col_size[c];
 		if (arrow_size <= 0)
 			break;
 	}
 
-	for (i = c; (i >= 0) && (i < priv->columns); i++)
-		n_buttons += priv->buttons_on_col[i];
+	for (i = c; (i >= 0) && (i < quick_box->priv->columns); i++)
+		n_buttons += quick_box->priv->buttons_on_col[i];
 
 	return MAX (0, n_buttons);
 }
@@ -547,8 +550,7 @@
 
 	g_return_val_if_fail (quick_box->priv->rows > 0, 0);
 
-	if (quick_box->priv->icon_size_follows_panel ||
-	    (quick_box->priv->rows == 1))
+	if (quick_box->priv->icon_size_follows_panel || (quick_box->priv->rows == 1))
 		return quick_box->priv->size;
 
 	child_size = (quick_box->priv->size - (quick_box->priv->rows - 1) * ICON_SPACING) / quick_box->priv->rows;
@@ -573,10 +575,14 @@
 	int             max_line_width, max_line_height;
 	int             initial_x, initial_y;
 	GtkRequisition  child_requisition;
-	gboolean        ignoring_arrow, do_not_fit = FALSE;
-	GList          *children, *scan, *hide_from_here = NULL;
+	gboolean        ignoring_arrow;
+	gboolean        do_not_fit = FALSE;
+	GList          *children;
+	GList          *scan;
+	GList          *hide_from_here = NULL;
 	int             under_arrow_children;
-	int             children_to_hide, n_children;
+	int             children_to_hide;
+	int             n_children;
 	gboolean        second_try = FALSE;
 	
 	quick_box = QUICK_BOX (widget);
@@ -613,7 +619,7 @@
 	max_height = allocation->height;
 
 	if (orientation == GTK_ORIENTATION_HORIZONTAL)
-		max_width  -= arrow_width + spacing;
+		max_width -= arrow_width + spacing;
 	else 
 		max_height -= arrow_height + spacing; 
 
@@ -636,9 +642,7 @@
 		GtkWidget     *child_widget = scan->data;
 		GtkAllocation  child_allocation;
 
-		if (ignoring_arrow 
-		    && last_n_child (quick_box, child_widget, under_arrow_children)) 
-		{
+		if (ignoring_arrow && last_n_child (quick_box, child_widget, under_arrow_children)) {
 			ignoring_arrow = FALSE;
 			if (orientation == GTK_ORIENTATION_HORIZONTAL) 
 				max_width += arrow_width + spacing;
@@ -662,7 +666,7 @@
 
 #ifdef DEBUG
 			g_print ("\n");
-			g_print ("[X] %d <--> %d\n", x + child_allocation.width, max_width);
+			g_print ("[X] (%d + %d) %d <--> %d\n", x, child_allocation.width, x + child_allocation.width, max_width);
 			g_print ("[Y] %d <--> %d\n", current_height, max_height);
 #endif
 			
@@ -677,7 +681,7 @@
 					do_not_fit = TRUE;
 					hide_from_here = scan;
 				} 
-				else {
+				else { /* new column */
 					x += max_line_width + spacing;
 					y = initial_y;
 					current_height = border_width;
@@ -752,6 +756,7 @@
 		}
 
 		gtk_widget_size_allocate (arrow, &child_allocation);
+
 		gtk_widget_show (arrow);
 		gtk_widget_set_sensitive (arrow, TRUE);
 
@@ -759,10 +764,11 @@
 					 (GtkCallback) hide_non_current_arrow_cb,
 					 quick_box);
 	} 
-	else 
+	else {
 		quick_box_forall_arrows (quick_box,
 					 (GtkCallback) hide_all_arrows_cb,
 					 NULL);
+	}
 	
 	if (do_not_fit) {
 		children_to_hide = MAX (g_list_length (hide_from_here), under_arrow_children);

Modified: trunk/src/quick-lounge.c
==============================================================================
--- trunk/src/quick-lounge.c	(original)
+++ trunk/src/quick-lounge.c	Mon Feb  2 15:27:27 2009
@@ -1158,41 +1158,63 @@
 }
 
 
-void
+gboolean
 quick_lounge_set_min_visible_cols (QuickLounge *quick_lounge,
-				   int          cols)
+				   int          value)
 {
-	GError *error = NULL;
-
-	if (cols >= quick_box_get_max_visible_cols (quick_lounge->quick_box))
-		cols = quick_box_get_min_visible_cols (quick_lounge->quick_box);
-
-	quick_box_set_min_visible_cols (quick_lounge->quick_box, cols);
+	gboolean needs_update = FALSE;
+	
+	if (value == quick_box_get_min_visible_cols (quick_lounge->quick_box))
+		return FALSE;
+	if (value < 0)
+		return FALSE;
+
+	if (value > quick_box_get_max_visible_cols (quick_lounge->quick_box)) {
+		quick_box_set_max_visible_cols (quick_lounge->quick_box, value);
+		panel_applet_gconf_set_int (PANEL_APPLET (quick_lounge->applet),
+					    PREFS_MAX_VISIBLE_COLS,
+					    value,
+					    NULL);
+		needs_update = TRUE;
+	}
+	
+	quick_box_set_min_visible_cols (quick_lounge->quick_box, value);
 	panel_applet_gconf_set_int (PANEL_APPLET (quick_lounge->applet),
 				    PREFS_MIN_VISIBLE_COLS,
-				    cols,
-				    &error);
-	if (error != NULL)
-		_gtk_error_dialog_from_gerror_run (NULL, &error);
+				    value,
+				    NULL);
+			
+	return needs_update;
 }
 
 
-void
+gboolean
 quick_lounge_set_max_size (QuickLounge *quick_lounge,
 			   int          value)
 {
-	GError *error = NULL;
-
-	if (value <= quick_box_get_min_visible_cols (quick_lounge->quick_box))
-		value = quick_box_get_max_visible_cols (quick_lounge->quick_box);
+	gboolean needs_update = FALSE;
 
+	if (value == quick_box_get_max_visible_cols (quick_lounge->quick_box))
+		return FALSE;
+	if (value < 0)
+		return FALSE;
+
+	if (value < quick_box_get_min_visible_cols (quick_lounge->quick_box)) {
+		quick_box_set_min_visible_cols (quick_lounge->quick_box, value);
+		panel_applet_gconf_set_int (PANEL_APPLET (quick_lounge->applet),
+					    PREFS_MIN_VISIBLE_COLS,
+					    value,
+					    NULL);
+		needs_update = TRUE;
+	}
+	
 	quick_box_set_max_visible_cols (quick_lounge->quick_box, value);
 	panel_applet_gconf_set_int (PANEL_APPLET (quick_lounge->applet),
 				    PREFS_MAX_VISIBLE_COLS,
 				    value,
-				    &error);
-	if (error != NULL)
-		_gtk_error_dialog_from_gerror_run (NULL, &error);
+				    NULL);
+
+	return needs_update;
 }
 
 

Modified: trunk/src/quick-lounge.h
==============================================================================
--- trunk/src/quick-lounge.h	(original)
+++ trunk/src/quick-lounge.h	Mon Feb  2 15:27:27 2009
@@ -42,30 +42,23 @@
 } QuickLounge;
 
 
-void    quick_lounge_save_order                  (QuickLounge  *quick_lounge);
-
-char *  quick_lounge_get_path                    (QuickLounge  *quick_lounge);
-
-void    quick_lounge_load_uri                    (QuickLounge  *quick_lounge, 
-						  const char   *uri);
-
-void    quick_lounge_set_min_visible_cols        (QuickLounge  *quick_lounge, 
-						  int           cols);
-
-void    quick_lounge_set_max_size                (QuickLounge  *quick_lounge, 
-						  int           value);
-
-void    quick_lounge_set_icon_size_follows_panel (QuickLounge  *quick_lounge, 
-						  gboolean      value);
-
-void    quick_lounge_new_launcher                (QuickLounge  *quick_lounge,
-						  int           pos);
+void      quick_lounge_save_order                  (QuickLounge  *quick_lounge);
+char *    quick_lounge_get_path                    (QuickLounge  *quick_lounge);
+void      quick_lounge_load_uri                    (QuickLounge  *quick_lounge, 
+						    const char   *uri);
+gboolean  quick_lounge_set_min_visible_cols        (QuickLounge  *quick_lounge, 
+						    int           cols);
+gboolean  quick_lounge_set_max_size                (QuickLounge  *quick_lounge, 
+						    int           value);
+void      quick_lounge_set_icon_size_follows_panel (QuickLounge  *quick_lounge, 
+						    gboolean      value);
+void      quick_lounge_new_launcher                (QuickLounge  *quick_lounge,
+						    int           pos);
 
 /* utils */
 
-void    quick_lounge_util__item_properties       (QuickLounge *quick_lounge,
-						  GtkWidget   *button);
-
-char *  quick_lounge_util__get_unique_uri        (QuickLounge *quick_lounge);
+void    quick_lounge_util__item_properties         (QuickLounge  *quick_lounge,
+						    GtkWidget    *button);
+char *  quick_lounge_util__get_unique_uri          (QuickLounge  *quick_lounge);
 
 #endif /* QUICK_LOUNGE_H */



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