quick-lounge-applet r245 - in trunk: . src



Author: paobac
Date: Mon Feb  2 17:51:54 2009
New Revision: 245
URL: http://svn.gnome.org/viewvc/quick-lounge-applet?rev=245&view=rev

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

	* src/dlg-properties.c: update the button sensitivity.
	
	Fixes bug #532174 â Odd behaviour when changing the order of 
	the icons.


Modified:
   trunk/ChangeLog
   trunk/src/dlg-properties.c

Modified: trunk/src/dlg-properties.c
==============================================================================
--- trunk/src/dlg-properties.c	(original)
+++ trunk/src/dlg-properties.c	Mon Feb  2 17:51:54 2009
@@ -254,7 +254,11 @@
 	if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
 		return;
 
-	position = get_iter_position (data, &iter) - 1;
+	position = get_iter_position (data, &iter);
+	if (position == 0)
+		return;
+	position--;
+	
 	button = tree_view_move_iter_to (data, &iter, position, FALSE);
 	select_and_view_iter (data, &iter);
 	quick_box_reorder_child (data->quick_box, button, position);
@@ -263,7 +267,7 @@
 }
 
 
-static gboolean
+static void
 move_down_cb (GtkWidget  *widget, 
 	      DialogData *data)
 {
@@ -274,18 +278,20 @@
 
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->tree_view));
 	if (selection == NULL)
-                return FALSE;
+                return;
 	if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
-		return FALSE;
+		return;
 
-	position = get_iter_position (data, &iter) + 1;
+	position = get_iter_position (data, &iter);
+	if (position >= data->n - 1)
+		return;
+	position++;
+	
 	button = tree_view_move_iter_to (data, &iter, position, FALSE);
 	select_and_view_iter (data, &iter);
 	quick_box_reorder_child (data->quick_box, button, position);
 	
 	quick_lounge_save_order (data->quick_lounge);
-	
-	return FALSE;
 }
 
 
@@ -305,6 +311,9 @@
 		return;
 
 	position = get_iter_position (data, &iter);
+	if (position >= data->n - 1)
+		return;
+	
 	button = tree_view_move_iter_to (data, &iter, data->n - 2, TRUE);
 	select_and_view_iter (data, &iter);
 	quick_box_reorder_child (data->quick_box, button, data->n - 1);
@@ -329,6 +338,9 @@
 		return;
 
 	position = get_iter_position (data, &iter);
+	if (position == 0)
+		return;
+		
 	button = tree_view_move_iter_to (data, &iter, 0, FALSE);
 	select_and_view_iter (data, &iter);
 	quick_box_reorder_child (data->quick_box, button, 0);
@@ -343,28 +355,33 @@
 	GtkTreeSelection *selection;
 	GtkTreeIter       iter;
 	GtkWidget        *button;
-
+	int               position;
+	
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->tree_view));
 	if (selection == NULL)
                 return;
 	
 	if (! gtk_tree_selection_get_selected (selection, NULL, &iter)
-	    || (data->n == 0)) {
+	    || (data->n == 0)) 
+	{
 		gtk_widget_set_sensitive (data->btn_edit, FALSE);
 		gtk_widget_set_sensitive (data->btn_delete, FALSE);
-
 		return;
 	}
 
-	gtk_widget_set_sensitive (data->btn_edit, TRUE);
 	gtk_widget_set_sensitive (data->btn_delete, TRUE);
+
+	position = get_iter_position (data, &iter);
+	gtk_widget_set_sensitive (data->btn_top, position > 0);
+	gtk_widget_set_sensitive (data->btn_up, position > 0);
+	gtk_widget_set_sensitive (data->btn_down, position < data->n - 1);	
+	gtk_widget_set_sensitive (data->btn_bottom, position < data->n - 1);
 	
 	gtk_tree_model_get (data->model,
 			    &iter,
 			    COLUMN_DATA, &button,
 			    -1);
-	gtk_widget_set_sensitive (data->btn_edit, 
-				  ! QUICK_IS_SEPARATOR (button));
+	gtk_widget_set_sensitive (data->btn_edit, ! QUICK_IS_SEPARATOR (button));
 }
 
 
@@ -779,8 +796,8 @@
 		
 		button = tree_view_move_iter_to (ddata, &iter, pos, FALSE);
 		quick_box_reorder_child (ddata->quick_box, button, pos);
-
-	} else {
+	} 
+	else {
 		list = get_file_list_from_url_list (selection_data);
 		for (scan = list; scan; scan = scan->next) {
 			char      *src_uri = scan->data;
@@ -875,8 +892,8 @@
 	if ((widget->allocation.height - y < AUTO_SCROLL_THRESHOLD)
 	    && (adj->value + widget->allocation.height < adj->upper)) {
 		gtk_adjustment_set_value (adj, gtk_adjustment_get_value (adj) + AUTO_SCROLL_STEP);
-
-	} else 	if ((y < AUTO_SCROLL_THRESHOLD) && (adj->value > 0.0)) {
+	} 
+	else 	if ((y < AUTO_SCROLL_THRESHOLD) && (adj->value > 0.0)) {
 		gtk_adjustment_set_value (adj, gtk_adjustment_get_value (adj) - AUTO_SCROLL_STEP);
 	}
 



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