[maemo-commits] [maemo-commits] r13449 - in projects/haf/trunk/hildon-plugins-settings: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Aug 29 12:07:46 EEST 2007
Author: jobi
Date: 2007-08-29 12:07:45 +0300 (Wed, 29 Aug 2007)
New Revision: 13449

Modified:
   projects/haf/trunk/hildon-plugins-settings/ChangeLog
   projects/haf/trunk/hildon-plugins-settings/src/hildon-plugin-settings-dialog.c
Log:

2007-08-29  Johan Bilien  <johan.bilien at nokia.com>

	* src/hildon-plugin-settings-dialog.c:
	- set a insensitive message on the OK button
	- set the ok button to insensitive if less plugins than required
	are selected.
	Fixes: NB#63513



Modified: projects/haf/trunk/hildon-plugins-settings/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-plugins-settings/ChangeLog	2007-08-29 09:02:29 UTC (rev 13448)
+++ projects/haf/trunk/hildon-plugins-settings/ChangeLog	2007-08-29 09:07:45 UTC (rev 13449)
@@ -1,3 +1,11 @@
+2007-08-29  Johan Bilien  <johan.bilien at nokia.com>
+
+	* src/hildon-plugin-settings-dialog.c:
+	- set a insensitive message on the OK button
+	- set the ok button to insensitive if less plugins than required
+	are selected.
+	Fixes: NB#63513
+
 2007-08-28  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* src/hildon-plugin-settings-dialog.c

Modified: projects/haf/trunk/hildon-plugins-settings/src/hildon-plugin-settings-dialog.c
===================================================================
--- projects/haf/trunk/hildon-plugins-settings/src/hildon-plugin-settings-dialog.c	2007-08-29 09:02:29 UTC (rev 13448)
+++ projects/haf/trunk/hildon-plugins-settings/src/hildon-plugin-settings-dialog.c	2007-08-29 09:07:45 UTC (rev 13449)
@@ -39,6 +39,8 @@
 
 #include <hildon-desktop/hd-config.h>
 
+#include <hildon/hildon-helper.h>
+
 #define HPSD_OK _("tncpa_bv_tnsb_ok")
 #define HPSD_CANCEL _("tncpa_bv_tnsb_cancel")
 
@@ -46,6 +48,7 @@
 #define HPSD_TAB_TN "Task Navigator"
 
 #define HPSD_TITLE _("tncpa_ti_tnsb_title") 
+#define HPSD_NOT_ENOUGH_PLUGINS _("tncpa_ib_select_two_plugins")
 
 
 /* TODO: FIXME: 
@@ -192,7 +195,9 @@
 }
 
 static void 
-hildon_plugin_settings_dialog_check_limits (GtkTreeView *tw, HPSDTab *tab)
+hildon_plugin_settings_dialog_check_limits (HildonPluginSettingsDialog *dialog,
+                                            GtkTreeView *tw,
+                                            HPSDTab *tab)
 {
   gboolean selected;	
   GtkTreeIter iter;	
@@ -215,8 +220,9 @@
   }
   while (gtk_tree_model_iter_next (tm, &iter));  
 
-  if (tab->counter_limit > 0 && tab->counter_limit > tab->limit)
-    tab->limit = tab->counter_limit;	  
+  if (tab->counter_limit > 0 &&
+      tab->counter_limit > tab->limit)
+    tab->limit = tab->counter_limit;
 }
 
 static void 
@@ -334,6 +340,9 @@
 		  	 HPSD_OK,
 			 GTK_RESPONSE_OK);
 
+  hildon_helper_set_insensitive_message (settings->button_ok,
+                                         HPSD_NOT_ENOUGH_PLUGINS);
+
   button_up =
     gtk_dialog_add_button (dialog,
 	  		   "Up",
@@ -456,9 +465,12 @@
     tab->tw = GTK_TREE_VIEW (tw);
 
     g_object_set_data (G_OBJECT (tw), "tab-data", tab);
+    g_object_set_data (G_OBJECT (tw), "dialog", settings);
 
     if (tab->limit != HPSD_NO_LIMIT)
-      hildon_plugin_settings_dialog_check_limits (GTK_TREE_VIEW (tw), tab);
+      hildon_plugin_settings_dialog_check_limits (settings,
+                                                  GTK_TREE_VIEW (tw),
+                                                  tab);
 
     hildon_plugin_settings_dialog_fill_treeview (settings, GTK_TREE_VIEW (tw));
 
@@ -703,6 +715,7 @@
 		    "toggled",
 		    G_CALLBACK (hildon_plugin_settings_dialog_renderer_toggled_cb),
 		    (gpointer)tw);
+
 }	
 
 static gboolean 
@@ -892,6 +905,7 @@
   gboolean selected;
   GtkTreeModel *tm = gtk_tree_view_get_model (tw);
   HPSDTab *tab = NULL;
+  HildonPluginSettingsDialog *settings;
   
   if (!gtk_tree_model_get_iter_from_string (tm, &iter, path))
     return;
@@ -901,6 +915,7 @@
 		      -1);
 
   tab = g_object_get_data (G_OBJECT (tw),"tab-data");
+  settings = g_object_get_data (G_OBJECT (tw),"dialog");
 
   if (tab && tab->limit != HPSD_NO_LIMIT)
   {
@@ -911,8 +926,11 @@
       tab->counter_limit = (!selected) ? tab->counter_limit + 1: tab->counter_limit - 1;	    
 
     if (tab->counter_limit < 0)
-      tab->counter_limit = 0;	    
-  }	  
+      tab->counter_limit = 0;
+
+    gtk_widget_set_sensitive (settings->button_ok,
+                              tab->counter_limit >= tab->limit);
+  }
   
   if (GTK_IS_TREE_MODEL_FILTER (tm))
   {
@@ -975,7 +993,12 @@
     HPSDTab *tab = (HPSDTab *)container_tab->data;
 
     gtk_widget_set_sensitive (settings->priv->button_down, tab->is_sorted);
+
+    gtk_widget_set_sensitive (settings->button_ok,
+                              tab->limit == HPSD_NO_LIMIT ||
+                              tab->counter_limit >= tab->limit);
   }
+
 }
 
 GtkWidget *
@@ -1049,7 +1072,7 @@
 
   tab->limit = limit;
 
-  hildon_plugin_settings_dialog_check_limits (tab->tw, tab);
+  hildon_plugin_settings_dialog_check_limits (settings, tab->tw, tab);
 }
 
 GtkTreeModel *


More information about the maemo-commits mailing list