[gthumb: 5/10] [flicker] allow to change the server name in the message dialogs



commit e7928bc22bf1aa68dd902a6b043165854346fc5e
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Apr 5 23:14:04 2010 +0200

    [flicker] allow to change the server name in the message dialogs

 extensions/flicker/data/ui/export-to-flickr.ui     |    1 -
 .../flicker/data/ui/flicker-ask-authorization.ui   |    6 +---
 .../data/ui/flicker-complete-authorization.ui      |    6 +---
 extensions/flicker/data/ui/import-from-flickr.ui   |    1 -
 extensions/flicker/dlg-export-to-flickr.c          |    5 +++
 extensions/flicker/dlg-import-from-flickr.c        |    5 +++
 extensions/flicker/flickr-authentication.c         |   27 +++++++++++++++++--
 extensions/flicker/flickr-connection.h             |    4 +-
 8 files changed, 38 insertions(+), 17 deletions(-)
---
diff --git a/extensions/flicker/data/ui/export-to-flickr.ui b/extensions/flicker/data/ui/export-to-flickr.ui
index 21cb7b4..e9e12e5 100644
--- a/extensions/flicker/data/ui/export-to-flickr.ui
+++ b/extensions/flicker/data/ui/export-to-flickr.ui
@@ -4,7 +4,6 @@
   <!-- interface-naming-policy project-wide -->
   <object class="GtkDialog" id="export_dialog">
     <property name="border_width">5</property>
-    <property name="title" translatable="yes">Export to Flickr</property>
     <property name="type_hint">dialog</property>
     <property name="has_separator">False</property>
     <child internal-child="vbox">
diff --git a/extensions/flicker/data/ui/flicker-ask-authorization.ui b/extensions/flicker/data/ui/flicker-ask-authorization.ui
index 8cc162b..4e9c69f 100644
--- a/extensions/flicker/data/ui/flicker-ask-authorization.ui
+++ b/extensions/flicker/data/ui/flicker-ask-authorization.ui
@@ -1,22 +1,18 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy project-wide -->
   <object class="GtkMessageDialog" id="ask_authorization_messagedialog">
     <property name="border_width">5</property>
-    <property name="title" translatable="yes">Upload to Flickr</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
     <property name="type_hint">normal</property>
     <property name="skip_taskbar_hint">True</property>
     <property name="message_type">other</property>
-    <property name="text" translatable="yes">gthumb requires your authorization to upload the photos to Flickr</property>
-    <property name="secondary_text" translatable="yes">Click 'Authorize' to open your web browser and authorize gthumb to upload photos to Flickr. When you're finished, return to this window to complete the authorization.</property>
     <property name="image">icon_image</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox1">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
           <object class="GtkHButtonBox" id="dialog-action_area1">
diff --git a/extensions/flicker/data/ui/flicker-complete-authorization.ui b/extensions/flicker/data/ui/flicker-complete-authorization.ui
index 4b11130..dc8450c 100644
--- a/extensions/flicker/data/ui/flicker-complete-authorization.ui
+++ b/extensions/flicker/data/ui/flicker-complete-authorization.ui
@@ -1,22 +1,18 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy project-wide -->
   <object class="GtkMessageDialog" id="complete_authorization_messagedialog">
     <property name="border_width">5</property>
-    <property name="title" translatable="yes">Upload to Flickr</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
     <property name="type_hint">normal</property>
     <property name="skip_taskbar_hint">True</property>
     <property name="message_type">other</property>
-    <property name="text" translatable="yes">Return to this window when you have finished the authorization process on Flickr.com</property>
-    <property name="secondary_text" translatable="yes">Once you're done, click the 'Continue' button below.</property>
     <property name="image">icon_image1</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox4">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
           <object class="GtkHButtonBox" id="dialog-action_area4">
diff --git a/extensions/flicker/data/ui/import-from-flickr.ui b/extensions/flicker/data/ui/import-from-flickr.ui
index 4b24b11..66b1356 100644
--- a/extensions/flicker/data/ui/import-from-flickr.ui
+++ b/extensions/flicker/data/ui/import-from-flickr.ui
@@ -4,7 +4,6 @@
   <!-- interface-naming-policy project-wide -->
   <object class="GtkDialog" id="import_dialog">
     <property name="border_width">5</property>
-    <property name="title" translatable="yes">Import from Flickr</property>
     <property name="type_hint">dialog</property>
     <property name="has_separator">False</property>
     <child internal-child="vbox">
diff --git a/extensions/flicker/dlg-export-to-flickr.c b/extensions/flicker/dlg-export-to-flickr.c
index fdf735f..2601a2f 100644
--- a/extensions/flicker/dlg-export-to-flickr.c
+++ b/extensions/flicker/dlg-export-to-flickr.c
@@ -479,6 +479,7 @@ dlg_export_to_flickr (FlickrServer *server,
 	char       *total_size_formatted;
 	char       *text;
 	GtkWidget  *list_view;
+	char       *title;
 
 	data = g_new0 (DialogData, 1);
 	data->server = server;
@@ -539,6 +540,10 @@ dlg_export_to_flickr (FlickrServer *server,
 	gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (GET_WIDGET ("photoset_comboboxentry")))), g_file_info_get_edit_name (data->location->info));
 	gtk_widget_set_sensitive (GET_WIDGET ("upload_button"), FALSE);
 
+	title = g_strdup_printf (_("Export to %s"), data->server->name);
+	gtk_window_set_title (GTK_WINDOW (data->dialog), title);
+	g_free (title);
+
 	/* Set the signals handlers. */
 
 	g_signal_connect (G_OBJECT (data->dialog),
diff --git a/extensions/flicker/dlg-import-from-flickr.c b/extensions/flicker/dlg-import-from-flickr.c
index e9a5520..57213e8 100644
--- a/extensions/flicker/dlg-import-from-flickr.c
+++ b/extensions/flicker/dlg-import-from-flickr.c
@@ -515,6 +515,7 @@ dlg_import_from_flickr (FlickrServer *server,
 {
 	DialogData     *data;
 	GthThumbLoader *thumb_loader;
+	char           *title;
 
 	data = g_new0 (DialogData, 1);
 	data->server = server;
@@ -571,6 +572,10 @@ dlg_import_from_flickr (FlickrServer *server,
 	data->preferences_dialog = gth_import_preferences_dialog_new ();
 	gtk_window_set_transient_for (GTK_WINDOW (data->preferences_dialog), GTK_WINDOW (data->dialog));
 
+	title = g_strdup_printf (_("Import from %s"), data->server->name);
+	gtk_window_set_title (GTK_WINDOW (data->dialog), title);
+	g_free (title);
+
 	/* Set the signals handlers. */
 
 	g_signal_connect (G_OBJECT (data->dialog),
diff --git a/extensions/flicker/flickr-authentication.c b/extensions/flicker/flickr-authentication.c
index b85640f..845f081 100644
--- a/extensions/flicker/flickr-authentication.c
+++ b/extensions/flicker/flickr-authentication.c
@@ -299,20 +299,31 @@ complete_authorization (FlickrAuthentication *self)
 {
 	GtkBuilder *builder;
 	GtkWidget  *dialog;
+	char       *text;
+	char       *secondary_text;
 
 	gth_task_dialog (GTH_TASK (self->priv->conn), TRUE);
 
 	builder = _gtk_builder_new_from_file ("flicker-complete-authorization.ui", "flicker");
 	dialog = _gtk_builder_get_widget (builder, "complete_authorization_messagedialog");
+	text = g_strdup_printf ("Return to this window when you have finished the authorization process on %s", self->priv->conn->server->name);
+	secondary_text = g_strdup ("Once you're done, click the 'Continue' button below.");
+	g_object_set (dialog, "text", text, "secondary-text", secondary_text, NULL);
 	g_object_set_data_full (G_OBJECT (dialog), "builder", builder, g_object_unref);
 	g_signal_connect (dialog,
 			  "response",
 			  G_CALLBACK (complete_authorization_messagedialog_response_cb),
 			  self);
 
-	gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
+	if (GTK_WIDGET_VISIBLE (self->priv->dialog))
+		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->dialog));
+	else
+		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
 	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 	gtk_window_present (GTK_WINDOW (dialog));
+
+	g_free (secondary_text);
+	g_free (text);
 }
 
 
@@ -367,21 +378,31 @@ ask_authorization (FlickrAuthentication *self)
 {
 	GtkBuilder *builder;
 	GtkWidget  *dialog;
+	char       *text;
+	char       *secondary_text;
 
-	gtk_widget_hide (self->priv->dialog);
 	gth_task_dialog (GTH_TASK (self->priv->conn), TRUE);
 
 	builder = _gtk_builder_new_from_file ("flicker-ask-authorization.ui", "flicker");
 	dialog = _gtk_builder_get_widget (builder, "ask_authorization_messagedialog");
+	text = g_strdup_printf ("gthumb requires your authorization to upload the photos to %s", self->priv->conn->server->name);
+	secondary_text = g_strdup_printf ("Click 'Authorize' to open your web browser and authorize gthumb to upload photos to %s. When you're finished, return to this window to complete the authorization.", self->priv->conn->server->name);
+	g_object_set (dialog, "text", text, "secondary-text", secondary_text, NULL);
 	g_object_set_data_full (G_OBJECT (dialog), "builder", builder, g_object_unref);
 	g_signal_connect (dialog,
 			  "response",
 			  G_CALLBACK (ask_authorization_messagedialog_response_cb),
 			  self);
 
-	gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
 	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+	if (GTK_WIDGET_VISIBLE (self->priv->dialog))
+		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->dialog));
+	else
+		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
 	gtk_window_present (GTK_WINDOW (dialog));
+
+	g_free (secondary_text);
+	g_free (text);
 }
 
 
diff --git a/extensions/flicker/flickr-connection.h b/extensions/flicker/flickr-connection.h
index c0a2e81..09d193f 100644
--- a/extensions/flicker/flickr-connection.h
+++ b/extensions/flicker/flickr-connection.h
@@ -54,14 +54,14 @@ typedef struct _FlickrConnectionClass    FlickrConnectionClass;
 
 struct _FlickrConnection
 {
-	GObject __parent;
+	GthTask __parent;
 	FlickrServer *server;
 	FlickrConnectionPrivate *priv;
 };
 
 struct _FlickrConnectionClass
 {
-	GObjectClass __parent_class;
+	GthTaskClass __parent_class;
 };
 
 GType                flickr_connection_get_type           (void) G_GNUC_CONST;



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