[nautilus-actions] Re-implement matchcase button



commit 861b6b2a5f0d12b31a6fe2ad7a24dd850636060f
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Jun 4 15:30:29 2010 +0200

    Re-implement matchcase button

 src/nact/nact-ibasenames-tab.c           |   46 ++++++++++++++++++++++++++++++
 src/nact/nautilus-actions-config-tool.ui |   35 ++++++++++++----------
 2 files changed, 65 insertions(+), 16 deletions(-)
---
diff --git a/src/nact/nact-ibasenames-tab.c b/src/nact/nact-ibasenames-tab.c
index a686696..8bb9f7e 100644
--- a/src/nact/nact-ibasenames-tab.c
+++ b/src/nact/nact-ibasenames-tab.c
@@ -55,6 +55,7 @@ static GType   register_type( void );
 static void    interface_base_init( NactIBasenamesTabInterface *klass );
 static void    interface_base_finalize( NactIBasenamesTabInterface *klass );
 
+static void    on_matchcase_toggled( GtkToggleButton *button, NactIConditionsTab *instance );
 static void    on_tab_updatable_selection_changed( BaseWindow *window, gint count_selected );
 static void    on_tab_updatable_enable_tab( BaseWindow *window, NAObjectItem *item );
 
@@ -175,6 +176,7 @@ void
 nact_ibasenames_tab_runtime_init_toplevel( NactIBasenamesTab *instance )
 {
 	static const gchar *thisfn = "nact_ibasenames_tab_runtime_init_toplevel";
+	GtkWidget *button;
 
 	g_return_if_fail( NACT_IS_IBASENAMES_TAB( instance ));
 
@@ -194,6 +196,13 @@ nact_ibasenames_tab_runtime_init_toplevel( NactIBasenamesTab *instance )
 				TAB_UPDATABLE_SIGNAL_ENABLE_TAB,
 				G_CALLBACK( on_tab_updatable_enable_tab ));
 
+		button = base_window_get_widget( BASE_WINDOW( instance ), "BasenamesMatchcaseButton" );
+		base_window_signal_connect(
+				BASE_WINDOW( instance ),
+				G_OBJECT( button ),
+				"toggled",
+				G_CALLBACK( on_matchcase_toggled ));
+
 		nact_match_list_init_view( BASE_WINDOW( instance ), ITAB_NAME );
 	}
 }
@@ -233,6 +242,43 @@ nact_ibasenames_tab_dispose( NactIBasenamesTab *instance )
 }
 
 static void
+on_matchcase_toggled( GtkToggleButton *button, NactIConditionsTab *instance )
+{
+	NAObjectItem *item;
+	NAObjectProfile *profile;
+	NAIContext *context;
+	gboolean matchcase;
+	gboolean editable;
+
+	if( !st_on_selection_change ){
+
+		g_object_get(
+				G_OBJECT( data->window ),
+				TAB_UPDATABLE_PROP_EDITED_ACTION, &item,
+				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_EDITABLE, &editable,
+				NULL );
+
+		context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
+
+		if( context ){
+
+			matchcase = gtk_toggle_button_get_active( button );
+
+			if( editable ){
+				na_object_set_matchcase( context, matchcase );
+				g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, context, FALSE );
+
+			} else {
+				g_signal_handlers_block_by_func(( gpointer ) button, on_matchcase_toggled, instance );
+				gtk_toggle_button_set_active( button, !matchcase );
+				g_signal_handlers_unblock_by_func(( gpointer ) button, on_matchcase_toggled, instance );
+			}
+		}
+	}
+}
+
+static void
 on_tab_updatable_selection_changed( BaseWindow *window, gint count_selected )
 {
 	nact_match_list_on_selection_changed( window, ITAB_NAME, count_selected );
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index 65ae833..58b8e70 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -877,7 +877,7 @@ Defining several profiles lets you have several commands, each applying with a d
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkCheckButton" id="ConditionsMatchcaseButton1">
+                                      <object class="GtkCheckButton" id="BasenamesMatchcaseButton">
                                         <property name="label" translatable="yes">Match _case</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
@@ -2550,6 +2550,9 @@ Defining several profiles lets you have several commands, each applying with a d
       <placeholder/>
     </child>
     <child>
+      <placeholder/>
+    </child>
+    <child>
       <object class="GtkLabel" id="label3">
         <property name="visible">True</property>
         <property name="label" translatable="yes">This assistant will guide you through the process of importing items, actions or menus.</property>
@@ -2565,10 +2568,10 @@ Defining several profiles lets you have several commands, each applying with a d
         <child>
           <object class="GtkFileChooserWidget" id="ImportFileChooser">
             <property name="visible">True</property>
-            <property name="preview_widget_active">False</property>
-            <property name="select_multiple">True</property>
-            <property name="local_only">False</property>
             <property name="use_preview_label">False</property>
+            <property name="local_only">False</property>
+            <property name="select_multiple">True</property>
+            <property name="preview_widget_active">False</property>
           </object>
           <packing>
             <property name="position">0</property>
@@ -3359,39 +3362,39 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
   </object>
   <object class="GtkSizeGroup" id="CommandLabelSizeGroup">
     <widgets>
-      <widget name="label4"/>
-      <widget name="CommandParametersLabel"/>
-      <widget name="CommandPathLabel"/>
       <widget name="ProfileLabelLabel"/>
+      <widget name="CommandPathLabel"/>
+      <widget name="CommandParametersLabel"/>
+      <widget name="label4"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="CommandButtonSizeGroup">
     <widgets>
-      <widget name="CommandLegendButton"/>
       <widget name="CommandPathButton"/>
+      <widget name="CommandLegendButton"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="ActionLabelSizeGroup">
     <widgets>
-      <widget name="ActionMenuLabelLabel"/>
-      <widget name="ActionToolbarLabelLabel"/>
-      <widget name="ActionTooltipLabel"/>
       <widget name="ActionIconLabel"/>
+      <widget name="ActionTooltipLabel"/>
+      <widget name="ActionToolbarLabelLabel"/>
+      <widget name="ActionMenuLabelLabel"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="ExecutionModeSizeGroup">
     <widgets>
-      <widget name="label43"/>
-      <widget name="label44"/>
       <widget name="label45"/>
+      <widget name="label44"/>
+      <widget name="label43"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="PropertiesLabelSizeGroup">
     <widgets>
-      <widget name="label18"/>
-      <widget name="label39"/>
-      <widget name="label49"/>
       <widget name="label19"/>
+      <widget name="label49"/>
+      <widget name="label39"/>
+      <widget name="label18"/>
     </widgets>
   </object>
 </interface>



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