ui and string changes in gnome-volume-manager



The attached patch changes most of the strings in manager.c as well as
changing the way the dialog prompts look.

you can see the before/after here:

http://primates.ximian.com/~glesage/stuff/gvm/

Jeff

? INSTALL
? autogen
? depcomp
? gnome-volume-manager-1.3.3.tar.gz
? gnome-volume-manager-1.3.4.tar.gz
? intltool-extract.in
? intltool-merge.in
? intltool-update.in
? novell.schemas.in
? ui-string-changes.patch
? src/TODO
? src/mtab
? src/mtab.c
? src/mtab.h
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/ChangeLog,v
retrieving revision 1.178
retrieving revision 1.180
diff -u -r1.178 -r1.180
--- ChangeLog	15 Aug 2005 18:49:12 -0000	1.178
+++ ChangeLog	16 Aug 2005 20:30:49 -0000	1.180
@@ -1,3 +1,28 @@
+2005-08-16  Jeffrey Stedfast  <fejj novell com>
+
+	* gnome-volume-manager.schemas.in: Removed the
+	autoburn_photo_cd_command item. Added burn_cd/burn_dvd prompt
+	items. Also changed the eject command to "/bin/eject %d" so that
+	it actually works (eject without an arg tries to eject /dev/cdrom
+	which may or may not be what we want to eject).
+
+	* src/properties.c: Removed the autoburn_photo_cd_command stuff.
+
+	* src/manager.c: Many wording changes to the user prompts. Removed
+	autoburn_photo_cd stuff.
+	(gvm_prompt): Fixed various padding/spacing issues to make all
+	dialogs comply with the HIG. Also make sure to not save the user
+	response if they cancel the dialog. Other changes include taking
+	argc/argv instead of varargs and allowing secondary text to
+	contain mockup.
+	(gvm_run_cdburner): Remove the BURN_PHOTO_CD case.
+	(hal_device_added): For the PTP Camera case, use its own camera
+	prompt (which does not have the "Open Folder" choice).
+	(gvm_device_mounted): In the USB Mass-Storage camera case, handle
+	the case where the user selects "Open Folder".
+
+	* src/gvm.h: Removed the burn_photo_command member.
+
 2005-08-15  Jeffrey Stedfast  <fejj novell com>
 
 	* gnome-volume-manager.schemas.in: Changed the default CD player
Index: gnome-volume-manager.schemas.in
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/gnome-volume-manager.schemas.in,v
retrieving revision 1.21
retrieving revision 1.23
diff -u -r1.21 -r1.23
--- gnome-volume-manager.schemas.in	15 Aug 2005 18:49:12 -0000	1.21
+++ gnome-volume-manager.schemas.in	17 Aug 2005 15:23:56 -0000	1.23
@@ -107,17 +107,6 @@
       </schema>
 
       <schema>
-        <key>/schemas/desktop/gnome/volume_manager/autoburn_photo_cd_command</key>
-	<applyto>/desktop/gnome/volume_manager/autoburn_photo_cd_command</applyto>
-	<type>string</type>
-	<default>nautilus --no-desktop burn:</default>
-	<locale name="C">
-	  <short>Photo CD burn command</short>
-	  <long>Command to run when the user wishes to burn a Photo CD.</long>
-	</locale>
-      </schema>
-
-      <schema>
         <key>/schemas/desktop/gnome/volume_manager/autoburn_data_cd_command</key>
 	<applyto>/desktop/gnome/volume_manager/autoburn_data_cd_command</applyto>
 	<type>string</type>
@@ -318,7 +307,7 @@
         <key>/schemas/desktop/gnome/volume_manager/eject_command</key>
 	<applyto>/desktop/gnome/volume_manager/eject_command</applyto>
 	<type>string</type>
-	<default>/usr/bin/eject</default>
+	<default>/bin/eject %d</default>
 	<locale name="C">
 	  <short>Eject command</short>
 	  <long>Command to run when the eject button on a optical drive is
@@ -368,7 +357,7 @@
 	<default>0</default>
 	<locale name="C">
 	  <short>"Always take this action" checkbox for iPod Photos</short>
-	  <long>Action to take when an iPod Photo is encountered (syncronise music or import photos).</long>
+	  <long>Action to take when an iPod Photo is encountered.</long>
 	</locale>
       </schema>
 
Index: gnome-volume-properties.glade
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/gnome-volume-properties.glade,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- gnome-volume-properties.glade	10 Aug 2005 20:01:23 -0000	1.11
+++ gnome-volume-properties.glade	16 Aug 2005 15:04:12 -0000	1.12
@@ -451,114 +451,6 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkHBox" id="autoburn_photo_cd_hbox">
-				      <property name="visible">True</property>
-				      <property name="homogeneous">False</property>
-				      <property name="spacing">12</property>
-
-				      <child>
-					<widget class="GtkLabel" id="label36">
-					  <property name="visible">True</property>
-					  <property name="label" translatable="yes">Command for _Photo CDs:</property>
-					  <property name="use_underline">True</property>
-					  <property name="use_markup">False</property>
-					  <property name="justify">GTK_JUSTIFY_LEFT</property>
-					  <property name="wrap">False</property>
-					  <property name="selectable">False</property>
-					  <property name="xalign">0.5</property>
-					  <property name="yalign">0.5</property>
-					  <property name="xpad">0</property>
-					  <property name="ypad">0</property>
-					  <property name="mnemonic_widget">autoburn_photo_cd_command</property>
-					  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-					  <property name="width_chars">-1</property>
-					  <property name="single_line_mode">False</property>
-					  <property name="angle">0</property>
-					</widget>
-					<packing>
-					  <property name="padding">0</property>
-					  <property name="expand">False</property>
-					  <property name="fill">False</property>
-					</packing>
-				      </child>
-
-				      <child>
-					<widget class="GnomeFileEntry" id="autoburn_photo_cd_command_fileentry">
-					  <property name="visible">True</property>
-					  <property name="max_saved">10</property>
-					  <property name="browse_dialog_title" translatable="yes">Select program to burn photo CDs</property>
-					  <property name="directory_entry">False</property>
-					  <property name="modal">False</property>
-					  <property name="use_filechooser">True</property>
-					  <property name="filechooser_action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
-
-					  <child internal-child="entry">
-					    <widget class="GtkEntry" id="autoburn_photo_cd_command">
-					      <property name="visible">True</property>
-					      <property name="can_focus">True</property>
-					      <property name="editable">True</property>
-					      <property name="visibility">True</property>
-					      <property name="max_length">0</property>
-					      <property name="text" translatable="yes"></property>
-					      <property name="has_frame">True</property>
-					      <property name="invisible_char">*</property>
-					      <property name="activates_default">False</property>
-					    </widget>
-					  </child>
-					</widget>
-					<packing>
-					  <property name="padding">0</property>
-					  <property name="expand">True</property>
-					  <property name="fill">True</property>
-					</packing>
-				      </child>
-				    </widget>
-				    <packing>
-				      <property name="padding">0</property>
-				      <property name="expand">True</property>
-				      <property name="fill">True</property>
-				    </packing>
-				  </child>
-				</widget>
-				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">True</property>
-				  <property name="fill">True</property>
-				</packing>
-			      </child>
-
-			      <child>
-				<widget class="GtkHBox" id="hbox75">
-				  <property name="visible">True</property>
-				  <property name="homogeneous">False</property>
-				  <property name="spacing">0</property>
-
-				  <child>
-				    <widget class="GtkLabel" id="label34">
-				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">    </property>
-				      <property name="use_underline">False</property>
-				      <property name="use_markup">False</property>
-				      <property name="justify">GTK_JUSTIFY_LEFT</property>
-				      <property name="wrap">False</property>
-				      <property name="selectable">False</property>
-				      <property name="xalign">0.5</property>
-				      <property name="yalign">0.5</property>
-				      <property name="xpad">0</property>
-				      <property name="ypad">0</property>
-				      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-				      <property name="width_chars">-1</property>
-				      <property name="single_line_mode">False</property>
-				      <property name="angle">0</property>
-				    </widget>
-				    <packing>
-				      <property name="padding">0</property>
-				      <property name="expand">False</property>
-				      <property name="fill">False</property>
-				    </packing>
-				  </child>
-
-				  <child>
 				    <widget class="GtkHBox" id="autoburn_data_cd_hbox">
 				      <property name="visible">True</property>
 				      <property name="homogeneous">False</property>
Index: src/gvm.h
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/gvm.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- src/gvm.h	22 Jul 2005 21:00:24 -0000	1.8
+++ src/gvm.h	16 Aug 2005 15:04:12 -0000	1.9
@@ -13,7 +13,6 @@
 	
 	gboolean autoburn;
 	char *autoburn_audio_cd_command;
-	char *autoburn_photo_cd_command;
 	char *autoburn_data_cd_command;
 	
 	gboolean autoplay_cda;
Index: src/manager.c
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/manager.c,v
retrieving revision 1.75
retrieving revision 1.78
diff -u -r1.75 -r1.78
--- src/manager.c	12 Aug 2005 18:57:09 -0000	1.75
+++ src/manager.c	16 Aug 2005 20:52:06 -0000	1.78
@@ -66,7 +66,6 @@
 	AUTOBROWSE,
 	AUTOBURN,
 	AUTOBURN_AUDIO_CD_COMMAND,
-	AUTOBURN_PHOTO_CD_COMMAND,
 	AUTOBURN_DATA_CD_COMMAND,
 	AUTOIPOD,
 	AUTOIPOD_COMMAND,
@@ -93,7 +92,6 @@
 	{ GCONF_ROOT "autobrowse",                TYPE_BOOL,   &config.autobrowse                },
 	{ GCONF_ROOT "autoburn",                  TYPE_BOOL,   &config.autoburn                  },
 	{ GCONF_ROOT "autoburn_audio_cd_command", TYPE_STRING, &config.autoburn_audio_cd_command },
-	{ GCONF_ROOT "autoburn_photo_cd_command", TYPE_STRING, &config.autoburn_photo_cd_command },
 	{ GCONF_ROOT "autoburn_data_cd_command",  TYPE_STRING, &config.autoburn_data_cd_command  },
 	{ GCONF_ROOT "autoipod",                  TYPE_BOOL,   &config.autoipod                  },
 	{ GCONF_ROOT "autoipod_command",          TYPE_STRING, &config.autoipod_command          },
@@ -129,48 +127,52 @@
 	GVM_RESPONSE_SYNC_MUSIC,
 	GVM_RESPONSE_IMPORT_PHOTOS,
 	GVM_RESPONSE_BURN_AUDIO_CD,
-	GVM_RESPONSE_BURN_PHOTO_CD,
 	GVM_RESPONSE_BURN_DATA_CD,
 };
 
-static struct _GvmPromptButton GVM_BUTTONS_RUN_CANCEL[] = {
-	{ NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL },
-	{ N_("_Run Command"), NULL, GVM_RESPONSE_RUN },
+static struct _GvmPromptButton GVM_BUTTONS_AUTORUN[] = {
+	{ N_("_Ignore"), NULL, GTK_RESPONSE_CANCEL },
+	{ N_("_Allow Auto-Run"), NULL, GVM_RESPONSE_RUN },
 };
 
-static struct _GvmPromptButton GVM_BUTTONS_IMPORT_CANCEL[] = {
-	{ NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL },
-	{ N_("_Import Photos"), NULL, GVM_RESPONSE_IMPORT_PHOTOS },
+static struct _GvmPromptButton GVM_BUTTONS_CAMERA[] = {
+	{ N_("_Ignore"), NULL, GTK_RESPONSE_CANCEL },
+	{ N_("_Open Folder"), NULL, GVM_RESPONSE_BROWSE },
+	{ N_("Import _Photos"), NULL, GVM_RESPONSE_IMPORT_PHOTOS },
 };
 
-static struct _GvmPromptButton GVM_BUTTONS_IMPORT_SYNC_CANCEL[] = {
-	{ NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL },
-	{ N_("_Import Photos"), NULL, GVM_RESPONSE_IMPORT_PHOTOS },
-	{ N_("_Sync Music"), NULL, GVM_RESPONSE_SYNC_MUSIC },
+static struct _GvmPromptButton GVM_BUTTONS_PTP_CAMERA[] = {
+	{ N_("_Ignore"), NULL, GTK_RESPONSE_CANCEL },
+	{ N_("Import _Photos"), NULL, GVM_RESPONSE_IMPORT_PHOTOS },
 };
 
-static struct _GvmPromptButton GVM_BUTTONS_BROWSE_PLAY_CANCEL[] = {
-	{ NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL },
+static struct _GvmPromptButton GVM_BUTTONS_IPOD_PHOTO[] = {
+	{ N_("_Ignore"), NULL, GTK_RESPONSE_CANCEL },
+	{ N_("Import _Photos"), NULL, GVM_RESPONSE_IMPORT_PHOTOS },
+	{ N_("Manage _Music"), NULL, GVM_RESPONSE_SYNC_MUSIC },
+};
+
+static struct _GvmPromptButton GVM_BUTTONS_MIXED_CD[] = {
+	{ N_("_Ignore"), NULL, GTK_RESPONSE_CANCEL },
 	{ N_("_Browse Files"), NULL, GVM_RESPONSE_BROWSE },
-	{ N_("_Play Tracks"), NULL, GVM_RESPONSE_PLAY },
+	{ N_("_Play CD"), NULL, GVM_RESPONSE_PLAY },
 };
 
-static struct _GvmPromptButton GVM_BUTTONS_BURN_CDR_AUDIO_PHOTO_DATA[] = {
-	{ NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL },
-	{ N_("Burn _Audio CD"), NULL, GVM_RESPONSE_BURN_AUDIO_CD },
-	{ N_("Burn _Photo CD"), NULL, GVM_RESPONSE_BURN_PHOTO_CD },
-	{ N_("Burn _Data CD"), NULL, GVM_RESPONSE_BURN_DATA_CD },
+static struct _GvmPromptButton GVM_BUTTONS_BURN_CD[] = {
+	{ N_("_Ignore"), NULL, GTK_RESPONSE_CANCEL },
+	{ N_("Make _Audio CD"), NULL, GVM_RESPONSE_BURN_AUDIO_CD },
+	{ N_("Make _Data CD"), NULL, GVM_RESPONSE_BURN_DATA_CD },
 };
 
-static struct _GvmPromptButton GVM_BUTTONS_BURN_DVD_PHOTO_DATA[] = {
-	{ NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL },
-	{ N_("Burn _Photo DVD"), NULL, GVM_RESPONSE_BURN_PHOTO_CD },
-	{ N_("Burn _Data DVD"), NULL, GVM_RESPONSE_BURN_DATA_CD },
+static struct _GvmPromptButton GVM_BUTTONS_BURN_DVD[] = {
+	{ N_("_Ignore"), NULL, GTK_RESPONSE_CANCEL },
+	{ N_("Make _DVD"), NULL, GVM_RESPONSE_BURN_DATA_CD },
 };
 
 typedef enum {
 	GVM_PROMPT_AUTORUN,
 	GVM_PROMPT_IMPORT_CAMERA,
+	GVM_PROMPT_IMPORT_PTP_CAMERA,
 	GVM_PROMPT_IMPORT_PHOTOS,
 	GVM_PROMPT_IPOD_PHOTO,
 	GVM_PROMPT_CDA_EXTRA,
@@ -180,7 +182,8 @@
 
 static struct {
 	GtkDialogFlags flags;
-	GtkMessageType type;
+	
+	const char *icon;
 	
 	const char *help_uri;
 	
@@ -193,47 +196,67 @@
 	const char *primary;
 	const char *secondary;
 	int secondary_has_args;
+	int secondary_has_mockup;
 	
-	const char *dont_ask_again_key;
-	const char *dont_ask_again_label;
+	const char *ask_again_key;
+	const char *ask_again_label;
 } gvm_prompts[] = {
-	{ 0, GTK_MESSAGE_QUESTION, NULL, GVM_BUTTONS_RUN_CANCEL, 2, GVM_RESPONSE_RUN,
-	  N_("Run command from inserted media?"),
-	  N_("Run command from inserted media?"),
-	  N_("Do you want to run the file \"%s?\""),
-	  TRUE, GCONF_ROOT "prompts/autorun", N_("Always take this action") },
-	{ 0, GTK_MESSAGE_QUESTION, NULL, GVM_BUTTONS_IMPORT_CANCEL, 2, GVM_RESPONSE_IMPORT_PHOTOS,
-	  N_("Import photos from camera?"),
-	  N_("Import photos from camera?"),
-	  N_("There are photos on the plugged-in camera. Would you like to import these photographs into your album?"),
-	  FALSE, GCONF_ROOT "prompts/camera_import_photos", N_("Always take this action") },
-	{ 0, GTK_MESSAGE_QUESTION, NULL, GVM_BUTTONS_IMPORT_CANCEL, 2, GVM_RESPONSE_IMPORT_PHOTOS,
-	  N_("Import photos from device?"),
-	  N_("Import photos from device?"),
-	  N_("There are photos on the inserted media. Would you like to import these photographs into your album?"),
-	  FALSE, GCONF_ROOT "prompts/device_import_photos", N_("Always take this action") },
-	{ 0, GTK_MESSAGE_QUESTION, NULL, GVM_BUTTONS_IMPORT_SYNC_CANCEL, 3, GVM_RESPONSE_SYNC_MUSIC,
-	  N_("Import photos or music?"),
-	  N_("Import photos or music?"),
-	  N_("There are both photos and music on the plugged-in iPod. "
-	     "Would you like to import the photos or would you prefer "
-	     "to sync your music?"),
-	  FALSE, GCONF_ROOT "prompts/ipod_photo", N_("Always take this action") },
-	{ 0, GTK_MESSAGE_QUESTION, NULL, GVM_BUTTONS_BROWSE_PLAY_CANCEL, 3, GVM_RESPONSE_PLAY,
-	  N_("Browse files or play tracks from disc?"),
-	  N_("Browse files or play tracks from disc?"),
-	  N_("This CD contains both music and data. What would you like to do?"),
-	  FALSE, GCONF_ROOT "prompts/cd_mixed", N_("Always take this action") },
-	{ 0, GTK_MESSAGE_QUESTION, NULL, GVM_BUTTONS_BURN_CDR_AUDIO_PHOTO_DATA, 4, GVM_RESPONSE_BURN_DATA_CD,
-	  N_("Burn audio, photo, or data CD?"),
-	  N_("Burn audio, photo, or data CD?"),
-	  N_("Would you like to burn an audio, photo, or data CD?"),
-	  FALSE, GCONF_ROOT "prompts/burn_cd", N_("Always take this action") },
-	{ 0, GTK_MESSAGE_QUESTION, NULL, GVM_BUTTONS_BURN_DVD_PHOTO_DATA, 3, GVM_RESPONSE_BURN_DATA_CD,
-	  N_("Burn photo or data DVD?"),
-	  N_("Burn photo or data DVD?"),
-	  N_("Would you like to burn a photo or data DVD?"),
-	  FALSE, GCONF_ROOT "prompts/burn_cdr", N_("Always take this action") },
+	{ 0, "gnome-fs-executable", NULL,
+	  GVM_BUTTONS_AUTORUN, G_N_ELEMENTS (GVM_BUTTONS_AUTORUN),
+	  GVM_RESPONSE_RUN,
+	  N_("Auto-Run Confirmation"),
+	  N_("Auto-run capability detected."),
+	  N_("Would you like to allow <b>'${0}'</b> to run?"), TRUE, TRUE,
+	  NULL, NULL },
+	{ 0, "applets-screenshooter", NULL,
+	  GVM_BUTTONS_CAMERA, G_N_ELEMENTS (GVM_BUTTONS_CAMERA),
+	  GVM_RESPONSE_IMPORT_PHOTOS,
+	  N_("Camera Import"),
+	  N_("A camera has been detected."),
+	  N_("There are photos on the camera. Would you like to add these pictures to your album?"), FALSE, FALSE,
+	  GCONF_ROOT "prompts/camera_import_photos", N_("_Always perform this action") },
+	{ 0, "applets-screenshooter", NULL,
+	  GVM_BUTTONS_PTP_CAMERA, G_N_ELEMENTS (GVM_BUTTONS_PTP_CAMERA),
+	  GVM_RESPONSE_IMPORT_PHOTOS,
+	  N_("Camera Import"),
+	  N_("A camera has been detected."),
+	  N_("There are photos on the camera. Would you like to add these pictures to your album?"), FALSE, FALSE,
+	  GCONF_ROOT "prompts/ptp_camera_import_photos", N_("_Always perform this action") },
+	{ 0, "applets-screenshooter", NULL,
+	  GVM_BUTTONS_CAMERA, G_N_ELEMENTS (GVM_BUTTONS_CAMERA),
+	  GVM_RESPONSE_IMPORT_PHOTOS,
+	  N_("Photo Import"),
+	  N_("A photo card has been detected."),
+	  N_("There are photos on the card. Would you like to add these pictures to your album?"), FALSE, FALSE,
+	  GCONF_ROOT "prompts/device_import_photos", N_("_Always perform this action") },
+	{ 0, "gnome-dev-ipod", NULL,
+	  GVM_BUTTONS_IPOD_PHOTO, G_N_ELEMENTS (GVM_BUTTONS_IPOD_PHOTO),
+	  GVM_RESPONSE_SYNC_MUSIC,
+	  N_("Photos and Music"),
+	  N_("Photos were found on your music device."),
+	  N_("Would you like to import the photos or manage its music?"), FALSE, FALSE,
+	  GCONF_ROOT "prompts/ipod_photo", N_("_Always perform this action") },
+	{ 0, "gnome-dev-cdrom-audio", NULL,
+	  GVM_BUTTONS_MIXED_CD, G_N_ELEMENTS (GVM_BUTTONS_MIXED_CD),
+	  GVM_RESPONSE_PLAY,
+	  N_("Audio / Data CD"),
+	  N_("The CD in the drive contains both music and files."),
+	  N_("Would you like to listen to music or browse the files?"), FALSE, FALSE,
+	  GCONF_ROOT "prompts/cd_mixed", N_("_Always perform this action") },
+	{ 0, "gnome-dev-cdrom", NULL,
+	  GVM_BUTTONS_BURN_CD, G_N_ELEMENTS (GVM_BUTTONS_BURN_CD),
+	  GVM_RESPONSE_BURN_DATA_CD,
+	  N_("Choose Disc Type"),
+	  N_("You have inserted an empty disc."),
+	  N_("What would you like to do?"), FALSE, FALSE,
+	  NULL, NULL },
+	{ 0, "gnome-dev-disc-dvdr", NULL,
+	  GVM_BUTTONS_BURN_DVD, G_N_ELEMENTS (GVM_BUTTONS_BURN_DVD),
+	  GVM_RESPONSE_BURN_DATA_CD,
+	  N_("Choose Disc Type"),
+	  N_("You have inserted an empty disc."),
+	  N_("What would you like to do?"), FALSE, FALSE,
+	  NULL, NULL },
 };
 
 static void
@@ -253,24 +276,62 @@
 	}
 }
 
+static char *
+argv_expand (const char *format, int argc, char **argv)
+{
+	const char *start, *inptr;
+	GString *string;
+	char *str;
+	int i;
+	
+	string = g_string_new ("");
+	start = inptr = format;
+	
+	while (*inptr) {
+		while (*inptr) {
+			if (inptr[0] == '$' && inptr[1] == '{' && inptr[2] >= '0' && inptr[2] <= '9')
+				break;
+			inptr++;
+		}
+		
+		if (*inptr == '\0')
+			break;
+		
+		g_string_append_len (string, start, inptr - start);
+		
+		start = inptr;
+		inptr += 2;
+		i = strtol (inptr, &str, 10);
+		if (*str == '}' && i < argc) {
+			start = inptr = str + 1;
+			g_string_append (string, argv[i]);
+		}
+	}
+	
+	g_string_append (string, start);
+	
+	str = string->str;
+	g_string_free (string, FALSE);
+	
+	return str;
+}
+
 static int
-gvm_prompt (GvmPrompt prompt, ...)
+gvm_prompt (GvmPrompt prompt, int argc, char **argv)
 {
-	GtkWidget *dialog, *hbox, *image, *label, *check = NULL;
-	const char *stock_id = NULL;
+	GtkWidget *dialog, *hbox, *vbox, *image, *label, *check = NULL;
+	GnomeIconTheme *theme;
 	GConfClient *gconf;
 	GError *err = NULL;
-	GtkStockItem item;
+	const char *text;
 	int response, i;
-	GString *str;
-	va_list args;
-	char *text;
+	char *buf;
 	
 	gconf = gconf_client_get_default ();
 	
 	/* don't prompt the user again if she's already chosen a default action and has asked to not be prompetd again */
-	if (gvm_prompts[prompt].dont_ask_again_key) {
-		response = gconf_client_get_int (gconf, gvm_prompts[prompt].dont_ask_again_key, &err);
+	if (gvm_prompts[prompt].ask_again_key) {
+		response = gconf_client_get_int (gconf, gvm_prompts[prompt].ask_again_key, &err);
 		if (response > GVM_RESPONSE_NONE && err == NULL)
 			return response;
 		if (err != NULL)
@@ -284,6 +345,9 @@
 	gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *) dialog)->vbox, 0);
 	gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *) dialog)->action_area, 12);
 	
+	if (gvm_prompts[prompt].title)
+		gtk_window_set_title ((GtkWindow *) dialog, _(gvm_prompts[prompt].title));
+	
 	if (gvm_prompts[prompt].flags & GTK_DIALOG_MODAL)
 		gtk_window_set_modal ((GtkWindow *) dialog, TRUE);
 	
@@ -312,75 +376,74 @@
 	hbox = gtk_hbox_new (FALSE, 0);
 	gtk_container_set_border_width ((GtkContainer *) hbox, 12);
 	
-	switch (gvm_prompts[prompt].type) {
-	case GTK_MESSAGE_INFO:
-		stock_id = GTK_STOCK_DIALOG_INFO;
-		break;
-	case GTK_MESSAGE_QUESTION:
-		stock_id = GTK_STOCK_DIALOG_QUESTION;
-		break;
-	case GTK_MESSAGE_WARNING:
-		stock_id = GTK_STOCK_DIALOG_WARNING;
-		break;
-	case GTK_MESSAGE_ERROR:
-		stock_id = GTK_STOCK_DIALOG_ERROR;
-		break;
-	default:
-		stock_id = GTK_STOCK_DIALOG_INFO;
-		break;
+	/* set the icon */
+	theme = gnome_icon_theme_new ();
+	image = gtk_image_new ();
+	
+	if ((buf = gnome_icon_theme_lookup_icon (theme, gvm_prompts[prompt].icon, 48, NULL, NULL))) {
+		gtk_image_set_from_file ((GtkImage *) image, buf);
+		g_free (buf);
+	} else {
 	}
 	
-	image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_DIALOG);
 	gtk_misc_set_alignment ((GtkMisc *) image, 0.0, 0.0);
 	gtk_box_pack_start ((GtkBox *) hbox, image, FALSE, FALSE, 12);
 	gtk_widget_show (image);
 	
-	if (gvm_prompts[prompt].title)
-		gtk_window_set_title ((GtkWindow *) dialog, _(gvm_prompts[prompt].title));
-	else if (gtk_stock_lookup (stock_id, &item))
-		gtk_window_set_title ((GtkWindow *) dialog, item.label);
+	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_box_pack_start ((GtkBox *) hbox, vbox, FALSE, FALSE, 0);
+	
+	/* build the primary text */
+	buf = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>", _(gvm_prompts[prompt].primary));
 	
-	/* build the primary and secondary text */
-	str = g_string_new ("");
+	label = gtk_label_new (NULL);
+	gtk_misc_set_alignment ((GtkMisc *) label, 0.0, 0.5);
+	gtk_label_set_line_wrap ((GtkLabel *) label, FALSE);
+	gtk_label_set_markup ((GtkLabel *) label, buf);
+	g_free (buf);
 	
-	g_string_append (str, "<span weight=\"bold\" size=\"larger\">");
-	g_string_append (str, _(gvm_prompts[prompt].primary));
-	g_string_append (str, "</span>\n\n");
+	gtk_box_pack_start ((GtkBox *) vbox, label, FALSE, FALSE, 0);
+	gtk_widget_show (label);
 	
+	/* build the secondary text */
+	buf = NULL;
 	if (gvm_prompts[prompt].secondary_has_args) {
-		va_start (args, prompt);
-		text = g_strdup_vprintf (_(gvm_prompts[prompt].secondary), args);
-		va_end (args);
-		
-		g_string_append (str, text);
-		g_free (text);
+		text = buf = argv_expand (_(gvm_prompts[prompt].secondary), argc, argv);
 	} else {
-		g_string_append (str, _(gvm_prompts[prompt].secondary));
+		text = _(gvm_prompts[prompt].secondary);
 	}
 	
 	label = gtk_label_new (NULL);
+	gtk_misc_set_alignment ((GtkMisc *) label, 0.0, 0.5);
 	/*gtk_label_set_selectable ((GtkLabel *) label, TRUE);*/
 	gtk_label_set_line_wrap ((GtkLabel *) label, TRUE);
-	gtk_label_set_markup ((GtkLabel *) label, str->str);
+	if (gvm_prompts[prompt].secondary_has_mockup)
+		gtk_label_set_markup ((GtkLabel *) label, text);
+	else
+		gtk_label_set_text ((GtkLabel *) label, text);
+	g_free (buf);
 	
-	gtk_box_pack_start ((GtkBox *) hbox, label, FALSE, FALSE, 0);
+	gtk_box_pack_start ((GtkBox *) vbox, label, FALSE, FALSE, 6);
 	gtk_widget_show (label);
 	
 	gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dialog)->vbox, hbox, FALSE, FALSE, 0);
-	gtk_widget_show (hbox);
 	
 	/* conditionally add a checkbox to never bother the user again */
-	if (gvm_prompts[prompt].dont_ask_again_key && gvm_prompts[prompt].dont_ask_again_label) {
-		check = gtk_check_button_new_with_label (_(gvm_prompts[prompt].dont_ask_again_label));
-		gtk_container_set_border_width ((GtkContainer *) check, 12);
-		gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dialog)->vbox, check, FALSE, FALSE, 0);
+	if (gvm_prompts[prompt].ask_again_key && gvm_prompts[prompt].ask_again_label) {
+		check = gtk_check_button_new_with_mnemonic (_(gvm_prompts[prompt].ask_again_label));
+		gtk_container_set_border_width ((GtkContainer *) check, 0);
+		gtk_box_pack_start ((GtkBox *) vbox, check, FALSE, FALSE, 0);
 		gtk_widget_show (check);
 	}
 	
+	gtk_widget_show (vbox);
+	gtk_widget_show (hbox);
+	
 	response = gtk_dialog_run ((GtkDialog *) dialog);
 	
-	if (check != NULL && gtk_toggle_button_get_active ((GtkToggleButton *) check))
-		gconf_client_set_int (gconf, gvm_prompts[prompt].dont_ask_again_key, response, NULL);
+	if (check != NULL && gtk_toggle_button_get_active ((GtkToggleButton *) check)
+	    && response != GTK_RESPONSE_CANCEL)
+		gconf_client_set_int (gconf, gvm_prompts[prompt].ask_again_key, response, NULL);
 	
 	gtk_widget_destroy (dialog);
 	g_object_unref (gconf);
@@ -580,7 +643,14 @@
 static gboolean
 gvm_ask_autorun (const char *path)
 {
-	return gvm_prompt (GVM_PROMPT_AUTORUN, path) == GVM_RESPONSE_RUN;
+	gboolean autorun;
+	char *argv[1];
+	
+	argv[0] = g_path_get_basename (path);
+	autorun = gvm_prompt (GVM_PROMPT_AUTORUN, 1, argv) == GVM_RESPONSE_RUN;
+	g_free (argv[0]);
+	
+	return autorun;
 }
 
 /*
@@ -820,7 +890,7 @@
 		return;
 	
 	if (config.autophoto && gvm_check_photos (udi, device, mount_point)) {
-		if (gvm_prompt (GVM_PROMPT_IMPORT_PHOTOS) == GVM_RESPONSE_IMPORT_PHOTOS) {
+		if (gvm_prompt (GVM_PROMPT_IMPORT_PHOTOS, 0, NULL) == GVM_RESPONSE_IMPORT_PHOTOS) {
 			gvm_run_camera (udi, device, mount_point);
 			return;
 		}
@@ -918,8 +988,16 @@
 	
 	/* this is where the magic happens */
 	if (config.autophoto && gvm_udi_is_camera (udi)) {
-		if (gvm_prompt (GVM_PROMPT_IMPORT_CAMERA) == GVM_RESPONSE_IMPORT_PHOTOS)
+		switch (gvm_prompt (GVM_PROMPT_IMPORT_CAMERA, 0, NULL)) {
+		case GVM_RESPONSE_IMPORT_PHOTOS:
 			gvm_run_camera (udi, device, mount_point);
+			break;
+		case GVM_RESPONSE_BROWSE:
+			gvm_run_command (NAUTILUS_COMMAND, udi, device, mount_point);
+			break;
+		default:
+			break;
+		}
 	} else if (config.autoipod && gvm_udi_is_ipod (udi)) {
 		int action = GVM_RESPONSE_SYNC_MUSIC;
 		char *ipod_control;
@@ -928,7 +1006,7 @@
 		
 		if (gvm_check_photos (udi, device, ipod_control)) {
 			/* we have ourselves an iPod Photo - need to prompt what to do */
-			action = gvm_prompt (GVM_PROMPT_IPOD_PHOTO);
+			action = gvm_prompt (GVM_PROMPT_IPOD_PHOTO, 0, NULL);
 		}
 		
 		switch (action) {
@@ -1023,7 +1101,7 @@
 	}
 	
 	if (config.automount_media && config.autoplay_cda) {
-		action = gvm_prompt (GVM_PROMPT_CDA_EXTRA);
+		action = gvm_prompt (GVM_PROMPT_CDA_EXTRA, 0, NULL);
 	} else if (config.automount_media) {
 		action = GVM_RESPONSE_BROWSE;
 	} else if (config.autoplay_cda) {
@@ -1099,17 +1177,14 @@
 		return;
 	
 	if (type == WRITER_TYPE_DVD)
-		action = gvm_prompt (GVM_PROMPT_BURN_DVD);
+		action = gvm_prompt (GVM_PROMPT_BURN_DVD, 0, NULL);
 	else
-		action = gvm_prompt (GVM_PROMPT_BURN_CDR);
+		action = gvm_prompt (GVM_PROMPT_BURN_CDR, 0, NULL);
 	
 	switch (action) {
 	case GVM_RESPONSE_BURN_AUDIO_CD:
 		command = config.autoburn_audio_cd_command;
 		break;
-	case GVM_RESPONSE_BURN_PHOTO_CD:
-		command = config.autoburn_photo_cd_command;
-		break;
 	case GVM_RESPONSE_BURN_DATA_CD:
 		command = config.autoburn_data_cd_command;
 		break;
@@ -1344,7 +1419,7 @@
 			gvm_run_printer (udi);
 	} else if (gvm_udi_is_ptp_camera (udi)) {
 		/* if the device is a PTP camera with libgphoto2 support, launch the user-specified application */
-		if (config.autophoto && gvm_prompt (GVM_PROMPT_IMPORT_CAMERA) == GVM_RESPONSE_IMPORT_PHOTOS)
+		if (config.autophoto && gvm_prompt (GVM_PROMPT_IMPORT_PTP_CAMERA, 0, NULL) == GVM_RESPONSE_IMPORT_PHOTOS)
 			gvm_run_camera (udi, NULL, NULL);
 	}
 	
Index: src/properties.c
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/properties.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- src/properties.c	3 Aug 2005 18:55:52 -0000	1.24
+++ src/properties.c	16 Aug 2005 15:04:12 -0000	1.25
@@ -34,7 +34,6 @@
 	AUTOBROWSE,
 	AUTOBURN,
 	AUTOBURN_AUDIO_CD_COMMAND,
-	AUTOBURN_PHOTO_CD_COMMAND,
 	AUTOBURN_DATA_CD_COMMAND,
 	AUTOIPOD,
 	AUTOIPOD_COMMAND,
@@ -72,7 +71,6 @@
 	{ GCONF_ROOT "autobrowse",                TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autoburn",                  TYPE_BOOL,   NULL, FALSE },
 	{ GCONF_ROOT "autoburn_audio_cd_command", TYPE_STRING, NULL, FALSE },
-	{ GCONF_ROOT "autoburn_photo_cd_command", TYPE_STRING, NULL, FALSE },
 	{ GCONF_ROOT "autoburn_data_cd_command",  TYPE_STRING, NULL, FALSE },
 	{ GCONF_ROOT "autoipod",                  TYPE_BOOL,   NULL, TRUE  },
 	{ GCONF_ROOT "autoipod_command",          TYPE_STRING, NULL, FALSE },


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