gnome-user-share r294 - in trunk: . data po src



Author: hadess
Date: Mon Jan 19 14:24:14 2009
New Revision: 294
URL: http://svn.gnome.org/viewvc/gnome-user-share?rev=294&view=rev

Log:
2009-01-19  Bastien Nocera  <hadess hadess net>

	* data/Makefile.am:
	* data/file-share-properties.glade: Remove
	* data/file-share-properties.ui: add, and add help button
	* src/file-share-properties.c (write_out_password), (error_dialog),
	(help_button_clicked), (main): Add a button to launch the
	gnome-user-share help



Added:
   trunk/data/file-share-properties.ui
Removed:
   trunk/data/file-share-properties.glade
Modified:
   trunk/ChangeLog
   trunk/data/Makefile.am
   trunk/po/ChangeLog
   trunk/po/POTFILES.in
   trunk/src/file-share-properties.c

Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am	(original)
+++ trunk/data/Makefile.am	Mon Jan 19 14:24:14 2009
@@ -14,9 +14,6 @@
 autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
 autostart_in_files = gnome-user-share.desktop.in
 
-file-share-properties.ui : file-share-properties.glade
-	$(GTK_BUILDER_CONVERT) file-share-properties.glade file-share-properties.ui
-
 appdir = $(datadir)/gnome-user-share
 app_DATA=dav_user_2.0.conf dav_groupfile file-share-properties.ui
 
@@ -45,7 +42,7 @@
 	$(desktop_in_files)	\
 	dav_user_2.2.conf.in	\
 	gnome-user-share.desktop.in.in \
-	file-share-properties.glade
+	file-share-properties.ui
 
 CLEANFILES = $(desktop_DATA) $(autostart_DATA) file-share-properties.ui dav_user_2.2.conf
 

Added: trunk/data/file-share-properties.ui
==============================================================================
--- (empty file)
+++ trunk/data/file-share-properties.ui	Mon Jan 19 14:24:14 2009
@@ -0,0 +1,364 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.14"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkDialog" id="user_share_dialog">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">File Sharing Preferences</property>
+    <property name="resizable">False</property>
+    <property name="icon_name">folder-remote</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkVBox" id="vbox2">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <property name="spacing">18</property>
+            <child>
+              <object class="GtkVBox" id="vbox3">
+                <property name="visible">True</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label6">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Share Files over the Network&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkTable" id="table2">
+                        <property name="visible">True</property>
+                        <property name="n_rows">3</property>
+                        <property name="n_columns">2</property>
+                        <property name="column_spacing">12</property>
+                        <property name="row_spacing">6</property>
+                        <child>
+                          <object class="GtkComboBox" id="password_combo">
+                            <property name="visible">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>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="password_entry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="visibility">False</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="enable_check">
+                            <property name="label" translatable="yes">_Share public files on network</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="right_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label5">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">_Password:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">password_entry</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label4">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">_Require password:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">password_combo</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="vbox4">
+                <property name="visible">True</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label7">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Share Files over Bluetooth&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment3">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox1">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkCheckButton" id="enable_bluetooth_check">
+                            <property name="label" translatable="yes">Share public files over _Bluetooth</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="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="allow_write_bluetooth_check">
+                            <property name="label" translatable="yes">Allo_w remote devices to delete files</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="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="require_pairing_check">
+                            <property name="label" translatable="yes">Require re_mote devices to bond with this computer</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="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="vbox5">
+                <property name="visible">True</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label8">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Receive Files over Bluetooth&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment4">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkTable" id="table3">
+                        <property name="visible">True</property>
+                        <property name="n_rows">3</property>
+                        <property name="n_columns">2</property>
+                        <property name="column_spacing">12</property>
+                        <property name="row_spacing">6</property>
+                        <child>
+                          <object class="GtkCheckButton" id="enable_obexpush_check">
+                            <property name="label" translatable="yes">Receive files in _Downloads folder over Bluetooth</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="right_attach">2</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBox" id="accept_obexpush_combo">
+                            <property name="visible">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>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label9">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">_Accept files: </property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">accept_obexpush_combo</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="notify_received_obexpush_check">
+                            <property name="label" translatable="yes">_Notify about received files</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="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="close_button">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help_button">
+                <property name="label" translatable="yes">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-7">close_button</action-widget>
+      <action-widget response="0">help_button</action-widget>
+    </action-widgets>
+  </object>
+</interface>

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Mon Jan 19 14:24:14 2009
@@ -1,7 +1,7 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
 data/desktop_gnome_file_sharing.schemas.in
-data/file-share-properties.glade
+data/file-share-properties.ui
 data/gnome-user-share-properties.desktop.in
 data/gnome-user-share.desktop.in.in
 src/file-share-properties.c

Modified: trunk/src/file-share-properties.c
==============================================================================
--- trunk/src/file-share-properties.c	(original)
+++ trunk/src/file-share-properties.c	Mon Jan 19 14:24:14 2009
@@ -32,7 +32,7 @@
 
 #include "user_share-private.h"
 
-#define REALM "Please log in as the user guest"
+#define REALM N_("Please log in as the user guest")
 #define USER "guest"
 
 static GtkBuilder* builder;
@@ -47,10 +47,10 @@
     char *filename;
     FILE *file;
 
-    to_hash = g_strdup_printf ("%s:%s:%s", USER, REALM, password);
+    to_hash = g_strdup_printf ("%s:%s:%s", USER, _(REALM), password);
     ascii_digest = g_compute_checksum_for_string (G_CHECKSUM_MD5, to_hash, strlen (to_hash));
     g_free (to_hash);
-    line = g_strdup_printf ("%s:%s:%s\n", USER, REALM, ascii_digest);
+    line = g_strdup_printf ("%s:%s:%s\n", USER, _(REALM), ascii_digest);
     g_free (ascii_digest);
 
     filename = g_build_filename (g_get_user_config_dir (), "user-share", "passwd", NULL);
@@ -63,7 +63,6 @@
 
     g_free (filename);
     g_free (line);
-    
 }
 
 static void
@@ -251,7 +250,7 @@
     guint setting;
 
     setting = gtk_combo_box_get_active (combo_box);
-    
+
     client = gconf_client_get_default ();
 
     gconf_client_set_string (client,
@@ -397,7 +396,7 @@
     guint setting;
 
     setting = gtk_combo_box_get_active (combo_box);
-    
+
     client = gconf_client_get_default ();
 
     gconf_client_set_string (client,
@@ -425,6 +424,51 @@
 	g_object_unref (client);
 }
 
+static GtkWidget *
+error_dialog (const char *title,
+	      const char *reason,
+	      GtkWindow *parent)
+{
+	GtkWidget *error_dialog;
+
+	if (reason == NULL)
+		reason = _("No reason");
+
+	error_dialog =
+		gtk_message_dialog_new (parent,
+					GTK_DIALOG_MODAL,
+					GTK_MESSAGE_ERROR,
+					GTK_BUTTONS_OK,
+					"%s", title);
+	gtk_message_dialog_format_secondary_text
+		(GTK_MESSAGE_DIALOG (error_dialog), "%s", reason);
+
+	gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+	gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5); 
+	gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+					 GTK_RESPONSE_OK);
+	gtk_window_set_modal (GTK_WINDOW (error_dialog), TRUE);
+
+	return error_dialog;
+}
+
+static void
+help_button_clicked (GtkButton *button, GtkWidget *window)
+{
+	GError *error = NULL;
+
+	if (gtk_show_uri (gtk_widget_get_screen (window), "ghelp:gnome-user-share", gtk_get_current_event_time (), &error) == FALSE) {
+		GtkWidget *dialog;
+
+		dialog = error_dialog (_("Could not display the help contents."), error->message, GTK_WINDOW (window));
+		g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK
+				  (gtk_widget_destroy), error_dialog);
+		gtk_window_present (GTK_WINDOW (dialog));
+
+		g_error_free (error);
+	}
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -454,8 +498,14 @@
     gtk_builder_add_from_file (builder, DATADIR"file-share-properties.ui", &error);
 
     if (error) {
-      g_error ("building ui from %s failed: %s", DATADIR"file-share-properties.ui", error->message);
-      g_clear_error (&error);
+      GtkWidget *dialog;
+
+      dialog = error_dialog (_("Could not build interface."), error->message, NULL);
+      gtk_dialog_run (GTK_DIALOG (dialog));
+      gtk_widget_destroy (dialog);
+
+      g_error_free (error);
+      return 1;
     }
 
     window = GTK_WIDGET (gtk_builder_get_object (builder, "user_share_dialog"));
@@ -555,6 +605,9 @@
 
     g_signal_connect (GTK_WIDGET (gtk_builder_get_object (builder, "close_button")),
 		      "clicked", G_CALLBACK (gtk_main_quit), NULL);
+    g_signal_connect (GTK_WIDGET (gtk_builder_get_object (builder, "help_button")),
+		      "clicked", G_CALLBACK (help_button_clicked),
+		      gtk_builder_get_object (builder, "user_share_dialog"));
 
     gconf_client_notify_add (client,
 			     FILE_SHARING_ENABLED,



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