[nautilus-actions] Add description data



commit 2fc981e7cc36d662bfa20b4ec4e98b924359a8d6
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Mar 29 06:54:12 2010 +0200

    Add description data

 ChangeLog                                |    6 ++
 src/api/na-object-api.h                  |    2 +
 src/nact/nact-iaction-tab.c              |   31 ++++++++-
 src/nact/nautilus-actions-config-tool.ui |  109 ++++++++++++++++++------------
 4 files changed, 105 insertions(+), 43 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6b02191..5877b6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -218,6 +218,12 @@
 	* src/io-desktop/nadp-writer.c (nadp_iio_provider_write_item):
 	Remove key when it is no more set.
 
+	* src/api/na-object-api.h
+	(na_object_get_description, na_object_set_description): New macros.
+
+	* src/nact/nact-iaction-tab.c:
+	* src/nact/nautilus-actions-config-tool.ui: Add description entry.
+
 	* src/io-desktop/nadp-keys.h: Remove unused keys.
 
 	* src/io-desktop/nadp-reader.c (nadp_reader_ifactory_provider_read_done):
diff --git a/src/api/na-object-api.h b/src/api/na-object-api.h
index 3100375..6b46826 100644
--- a/src/api/na-object-api.h
+++ b/src/api/na-object-api.h
@@ -98,6 +98,7 @@ G_BEGIN_DECLS
  */
 #define na_object_get_tooltip( obj )					(( gchar * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_TOOLTIP ))
 #define na_object_get_icon( obj )						(( gchar * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_ICON ))
+#define na_object_get_description( obj )				(( gchar * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_DESCRIPTION ))
 #define na_object_get_items( obj )						(( GList * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_SUBITEMS ))
 #define na_object_get_items_slist( obj )				(( GSList * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_SUBITEMS_SLIST ))
 #define na_object_is_enabled( obj )						(( gboolean ) GPOINTER_TO_UINT( na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_ENABLED )))
@@ -107,6 +108,7 @@ G_BEGIN_DECLS
 
 #define na_object_set_tooltip( obj, tooltip )			na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_TOOLTIP, ( const void * )( tooltip ))
 #define na_object_set_icon( obj, icon )					na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_ICON, ( const void * )( icon ))
+#define na_object_set_description( obj, desc )			na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_DESCRIPTION, ( const void * )( desc ))
 #define na_object_set_items( obj, list )				na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_SUBITEMS, ( const void * )( list ))
 #define na_object_set_items_slist( obj, slist )			na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_SUBITEMS_SLIST, ( const void * )( slist ))
 #define na_object_set_enabled( obj, enabled )			na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_ENABLED, ( const void * ) GUINT_TO_POINTER( enabled ))
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index e933b9c..2608c97 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -111,8 +111,8 @@ static void          release_icon_combobox( NactIActionTab *instance );
 
 static GtkButton    *get_enabled_button( NactIActionTab *instance );
 static void          on_enabled_toggled( GtkToggleButton *button, NactIActionTab *instance );
-
 static void          on_readonly_toggled( GtkToggleButton *button, NactIActionTab *instance );
+static void          on_description_changed( GtkEntry *entry, NactIActionTab *instance );
 
 static void          display_provider_name( NactIActionTab *instance, NAObjectItem *item );
 
@@ -334,6 +334,13 @@ nact_iaction_tab_runtime_init_toplevel( NactIActionTab *instance )
 				G_OBJECT( button ),
 				"toggled",
 				G_CALLBACK( on_readonly_toggled ));
+
+		label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionDescriptionEntry" );
+		base_window_signal_connect(
+				BASE_WINDOW( instance ),
+				G_OBJECT( label_widget ),
+				"changed",
+				G_CALLBACK( on_description_changed ));
 	}
 }
 
@@ -544,6 +551,12 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
 		gtk_widget_set_sensitive( GTK_WIDGET( readonly_button ), item != NULL );
 		nact_gtk_utils_set_editable( GTK_OBJECT( readonly_button ), FALSE );
 
+		label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionDescriptionEntry" );
+		label = item ? na_object_get_description( item ) : g_strdup( "" );
+		gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
+		g_free( label );
+		gtk_widget_set_sensitive( label_widget, item != NULL );
+
 		label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionItemID" );
 		label = item ? na_object_get_id( item ) : g_strdup( "" );
 		gtk_label_set_text( GTK_LABEL( label_widget ), label );
@@ -1134,6 +1147,22 @@ on_readonly_toggled( GtkToggleButton *button, NactIActionTab *instance )
 }
 
 static void
+on_description_changed( GtkEntry *entry, NactIActionTab *instance )
+{
+	NAObjectItem *edited;
+
+	g_object_get(
+			G_OBJECT( instance ),
+			TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
+			NULL );
+
+	if( edited ){
+		na_object_set_description( edited, gtk_entry_get_text( entry ));
+		g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+	}
+}
+
+static void
 display_provider_name( NactIActionTab *instance, NAObjectItem *item )
 {
 	GtkWidget *label_widget;
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index 3ed4e7b..452abd4 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -476,37 +476,6 @@ Menus are never displayed in the toolbar.</property>
                                     <property name="n_columns">2</property>
                                     <property name="column_spacing">5</property>
                                     <child>
-                                      <object class="GtkCheckButton" id="ActionEnabledButton">
-                                        <property name="label" translatable="yes">E_nabled</property>
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="receives_default">False</property>
-                                        <property name="use_underline">True</property>
-                                        <property name="draw_indicator">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkCheckButton" id="ActionReadonlyButton">
-                                        <property name="label" translatable="yes">_Read-only</property>
-                                        <property name="visible">True</property>
-                                        <property name="sensitive">False</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="receives_default">False</property>
-                                        <property name="use_underline">True</property>
-                                        <property name="draw_indicator">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
-                                        <property name="top_attach">1</property>
-                                        <property name="bottom_attach">2</property>
-                                      </packing>
-                                    </child>
-                                    <child>
                                       <object class="GtkLabel" id="ActionItemID">
                                         <property name="visible">True</property>
                                         <property name="xalign">0</property>
@@ -522,14 +491,6 @@ Menus are never displayed in the toolbar.</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label4">
-                                        <property name="visible">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="x_options">GTK_FILL</property>
-                                      </packing>
-                                    </child>
-                                    <child>
                                       <object class="GtkLabel" id="ActionIdLabel">
                                         <property name="visible">True</property>
                                         <property name="xalign">1</property>
@@ -566,8 +527,72 @@ Menus are never displayed in the toolbar.</property>
                                       </packing>
                                     </child>
                                     <child>
+                                      <object class="GtkLabel" id="ActionDescriptionLabel">
+                                        <property name="visible">True</property>
+                                        <property name="xalign">1</property>
+                                        <property name="label" translatable="yes">Description :</property>
+                                      </object>
+                                      <packing>
+                                        <property name="top_attach">1</property>
+                                        <property name="bottom_attach">2</property>
+                                        <property name="x_options">GTK_FILL</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkEntry" id="ActionDescriptionEntry">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="invisible_char">&#x25CF;</property>
+                                      </object>
+                                      <packing>
+                                        <property name="left_attach">1</property>
+                                        <property name="right_attach">2</property>
+                                        <property name="top_attach">1</property>
+                                        <property name="bottom_attach">2</property>
+                                      </packing>
+                                    </child>
+                                    <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <object class="GtkHBox" id="hbox10">
+                                        <property name="visible">True</property>
+                                        <property name="homogeneous">True</property>
+                                        <child>
+                                          <object class="GtkCheckButton" id="ActionEnabledButton">
+                                            <property name="label" translatable="yes">E_nabled</property>
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">False</property>
+                                            <property name="tooltip_text" translatable="yes">The item, action or menu, needs to be enabled to be candidate to be displayed in the Nautilus context menu or the Nautilus toolbar.
+When disabled, the item is only available in Nautilus-Actions Configuration Tool.</property>
+                                            <property name="use_underline">True</property>
+                                            <property name="draw_indicator">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkCheckButton" id="ActionReadonlyButton">
+                                            <property name="label" translatable="yes">Read-only</property>
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="receives_default">False</property>
+                                            <property name="tooltip_text" translatable="yes">An indicator of the intrinsic writability status of this item.</property>
+                                            <property name="focus_on_click">False</property>
+                                            <property name="draw_indicator">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="left_attach">1</property>
+                                        <property name="right_attach">2</property>
+                                      </packing>
+                                    </child>
                                   </object>
                                 </child>
                               </object>
@@ -1431,10 +1456,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="select_multiple">True</property>
-            <property name="local_only">False</property>
-            <property name="preview_widget_active">False</property>
             <property name="use_preview_label">False</property>
+            <property name="preview_widget_active">False</property>
+            <property name="local_only">False</property>
+            <property name="select_multiple">True</property>
           </object>
           <packing>
             <property name="position">0</property>



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