[nautilus-actions] Replace GtkLabel vith GtkTextView in import and export assistants



commit ccf788aed62ccb140b7abb7db7d36b7e6ae5325b
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Aug 17 22:55:02 2010 +0200

    Replace GtkLabel vith GtkTextView in import and export assistants

 ChangeLog                                |    7 +++++++
 src/nact/nact-assistant-export.c         |   24 ++++++++++++++++++++----
 src/nact/nact-assistant-export.ui        |   24 +++++++++++++++++-------
 src/nact/nact-assistant-import.c         |   24 ++++++++++++++++++++----
 src/nact/nautilus-actions-config-tool.ui |   24 +++++++++++++++++++-----
 5 files changed, 83 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4f1bf6b..524c461 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-08-17 Pierre Wieser <pwieser trychlos org>
 
+	* Replace GtkLable with GtkTextView in import and export assistants.
+
+	* src/nact/nact-assistant-export.c (assist_prepare_exportdone):
+	* src/nact/nact-assistant-import.c (prepare_importdone):
+	* src/nact/nact-assistant-export.ui:
+	* src/nact/nautilus-actions-config-tool.ui: Updated accordingly.
+
 	* src/core/na-core-utils.c (na_core_utils_str_split_first_word):
 	Accepts null or empty input string or output pointers.
 
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index 34a7d7d..2dbc731 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -772,14 +772,19 @@ assist_prepare_exportdone( NactAssistantExport *window, GtkAssistant *assistant,
 	gchar *label;
 	GSList *is;
 	gint errors;
-	GtkLabel *summary_label;
+	GtkTextView *summary_textview;
+	GtkTextBuffer *summary_buffer;
+	GtkTextTag *title_tag;
+	GtkTextIter start, end;
+	gint title_len;
 
 	g_debug( "%s: window=%p, assistant=%p, page=%p",
 			thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
 
 	/* i18n: result of the export assistant */
 	text = g_strdup( _( "Selected actions have been proceeded :" ));
-	tmp = g_strdup_printf( "<b>%s</b>\n\n", text );
+	title_len = g_utf8_strlen( text, -1 );
+	tmp = g_strdup_printf( "%s\n\n", text );
 	g_free( text );
 	text = tmp;
 
@@ -824,10 +829,21 @@ assist_prepare_exportdone( NactAssistantExport *window, GtkAssistant *assistant,
 		text = tmp;
 	}
 
-	summary_label = GTK_LABEL( base_window_get_widget( BASE_WINDOW( window ), "AssistantExportSummaryLabel" ));
-	gtk_label_set_markup( summary_label, text );
+	summary_textview = GTK_TEXT_VIEW( base_window_get_widget( BASE_WINDOW( window ), "AssistantExportSummaryTextView" ));
+	summary_buffer = gtk_text_view_get_buffer( summary_textview );
+	gtk_text_buffer_set_text( summary_buffer, text, -1 );
 	g_free( text );
 
+	title_tag = gtk_text_buffer_create_tag( summary_buffer, "title",
+			"weight", PANGO_WEIGHT_BOLD,
+			NULL );
+
+	gtk_text_buffer_get_iter_at_offset( summary_buffer, &start, 0 );
+	gtk_text_buffer_get_iter_at_offset( summary_buffer, &end, title_len );
+	gtk_text_buffer_apply_tag( summary_buffer, title_tag, &start, &end );
+
+	g_object_unref( title_tag );
+
 	gtk_assistant_set_page_complete( assistant, page, TRUE );
 	base_assistant_set_warn_on_cancel( BASE_ASSISTANT( window ), FALSE );
 	base_assistant_set_warn_on_esc( BASE_ASSISTANT( window ), FALSE );
diff --git a/src/nact/nact-assistant-export.ui b/src/nact/nact-assistant-export.ui
index c7ff43c..d89537d 100644
--- a/src/nact/nact-assistant-export.ui
+++ b/src/nact/nact-assistant-export.ui
@@ -10,6 +10,9 @@
     <property name="modal">True</property>
     <property name="type_hint">dialog</property>
     <child>
+      <placeholder/>
+    </child>
+    <child>
       <object class="GtkLabel" id="label20">
         <property name="visible">True</property>
         <property name="label" translatable="yes">This assistant will guide you through the process of exporting actions.</property>
@@ -88,10 +91,10 @@ to extend a selection.</property>
         <child>
           <object class="GtkFileChooserWidget" id="ExportFolderChooser">
             <property name="visible">True</property>
-            <property name="local_only">False</property>
-            <property name="preview_widget_active">False</property>
-            <property name="action">select-folder</property>
             <property name="use_preview_label">False</property>
+            <property name="action">select-folder</property>
+            <property name="preview_widget_active">False</property>
+            <property name="local_only">False</property>
           </object>
           <packing>
             <property name="position">0</property>
@@ -184,11 +187,18 @@ to extend a selection.</property>
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkLabel" id="AssistantExportSummaryLabel">
+          <object class="GtkScrolledWindow" id="scrolledwindow2">
             <property name="visible">True</property>
-            <property name="use_markup">True</property>
-            <property name="xalign">0</property>
-            <property name="xpad">20</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">automatic</property>
+            <property name="vscrollbar_policy">automatic</property>
+            <child>
+              <object class="GtkTextView" id="AssistantExportSummaryTextView">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="editable">False</property>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="position">0</property>
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index 0dc6921..9b991c7 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -766,14 +766,19 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
 	NAImporterResult *result;
 	GFile *file;
 	guint mode;
-	GtkLabel *summary_label;
+	GtkTextView *summary_textview;
+	GtkTextBuffer *summary_buffer;
+	GtkTextTag *title_tag;
+	GtkTextIter start, end;
+	gint title_len;
 
 	g_debug( "%s: window=%p, assistant=%p, page=%p",
 			thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
 
 	/* i18n: result of the import assistant */
 	text = g_strdup( _( "Selected files have been proceeded :" ));
-	tmp = g_strdup_printf( "<b>%s</b>\n\n", text );
+	title_len = g_utf8_strlen( text, -1 );
+	tmp = g_strdup_printf( "%s\n\n", text );
 	g_free( text );
 	text = tmp;
 
@@ -823,10 +828,21 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
 		text = tmp;
 	}
 
-	summary_label = GTK_LABEL( base_window_get_widget( BASE_WINDOW( window ), "AssistantImportSummaryLabel" ));
-	gtk_label_set_markup( summary_label, text );
+	summary_textview = GTK_TEXT_VIEW( base_window_get_widget( BASE_WINDOW( window ), "AssistantImportSummaryTextView" ));
+	summary_buffer = gtk_text_view_get_buffer( summary_textview );
+	gtk_text_buffer_set_text( summary_buffer, text, -1 );
 	g_free( text );
 
+	title_tag = gtk_text_buffer_create_tag( summary_buffer, "title",
+			"weight", PANGO_WEIGHT_BOLD,
+			NULL );
+
+	gtk_text_buffer_get_iter_at_offset( summary_buffer, &start, 0 );
+	gtk_text_buffer_get_iter_at_offset( summary_buffer, &end, title_len );
+	gtk_text_buffer_apply_tag( summary_buffer, title_tag, &start, &end );
+
+	g_object_unref( title_tag );
+
 	mode = get_import_mode( window );
 	na_iprefs_set_import_mode( window->private->gconf, IPREFS_IMPORT_ITEMS_IMPORT_MODE, mode );
 
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index bf1dedf..d6039ae 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -2769,6 +2769,12 @@ If the command is not found, or does not display the correct result, your item w
       <placeholder/>
     </child>
     <child>
+      <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>
@@ -2784,10 +2790,10 @@ If the command is not found, or does not display the correct result, your item w
         <child>
           <object class="GtkFileChooserWidget" id="ImportFileChooser">
             <property name="visible">True</property>
+            <property name="use_preview_label">False</property>
+            <property name="select_multiple">True</property>
             <property name="preview_widget_active">False</property>
             <property name="local_only">False</property>
-            <property name="select_multiple">True</property>
-            <property name="use_preview_label">False</property>
           </object>
           <packing>
             <property name="position">0</property>
@@ -3057,10 +3063,18 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkLabel" id="AssistantImportSummaryLabel">
+          <object class="GtkScrolledWindow" id="scrolledwindow6">
             <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="xpad">20</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">automatic</property>
+            <property name="vscrollbar_policy">automatic</property>
+            <child>
+              <object class="GtkTextView" id="AssistantImportSummaryTextView">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="editable">False</property>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="position">0</property>



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