Revision: 1842
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1842&view=rev
Author: Sikon
Date: 2007-12-18 10:11:45 -0800 (Tue, 18 Dec 2007)
Log Message:
-----------
HIG confirmation functions, converted one dialog
Modified Paths:
--------------
gtkpod/trunk/src/confirmation.c
gtkpod/trunk/src/confirmation.h
gtkpod/trunk/src/file_itunesdb.c
Modified: gtkpod/trunk/src/confirmation.c
===================================================================
--- gtkpod/trunk/src/confirmation.c 2007-12-18 13:49:25 UTC (rev 1841)
+++ gtkpod/trunk/src/confirmation.c 2007-12-18 18:11:45 UTC (rev 1842)
@@ -540,3 +540,59 @@
return GTK_RESPONSE_ACCEPT;
}
}
+
+gint gtkpod_confirmation_simple (GtkWindow *parent,
+ GtkMessageType
icon,
+ const gchar
*primary_text,
+ const gchar
*secondary_text,
+ const gchar
*accept_button_text)
+{
+ return gtkpod_confirmation_hig(parent, icon, primary_text,
secondary_text,
+
accept_button_text, NULL, NULL, NULL);
+}
+
+gint gtkpod_confirmation_hig (GtkWindow *parent,
+ GtkMessageType icon,
+ const gchar
*primary_text,
+ const gchar
*secondary_text,
+ const gchar
*accept_button_text,
+ const gchar
*cancel_button_text,
+ const gchar
*third_button_text,
+ const gchar
*help_context)
+{
+ gint result;
+
+ GtkWidget *dialog =
+ gtk_message_dialog_new(parent,
+ GTK_DIALOG_MODAL |
GTK_DIALOG_NO_SEPARATOR,
+ icon,
+ GTK_BUTTONS_NONE,
+ "%s",
+ primary_text);
+
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG(dialog),
+
"%s",
+
secondary_text);
+
+ if(third_button_text)
+ gtk_dialog_add_button(GTK_DIALOG(dialog), third_button_text,
GTK_RESPONSE_APPLY);
+
+ gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+ cancel_button_text ?
cancel_button_text : GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ accept_button_text ?
accept_button_text : GTK_STOCK_OK,
+ GTK_RESPONSE_OK,
+ NULL);
+
+ result = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+
+ switch (result)
+ {
+ case GTK_RESPONSE_OK:
+ case GTK_RESPONSE_APPLY:
+ return result;
+ default:
+ return GTK_RESPONSE_CANCEL;
+ };
+}
Modified: gtkpod/trunk/src/confirmation.h
===================================================================
--- gtkpod/trunk/src/confirmation.h 2007-12-18 13:49:25 UTC (rev 1841)
+++ gtkpod/trunk/src/confirmation.h 2007-12-18 18:11:45 UTC (rev 1842)
@@ -64,6 +64,21 @@
gpointer user_data1,
gpointer user_data2);
+gint gtkpod_confirmation_simple (GtkWindow *parent,
+ GtkMessageType
icon,
+ const gchar
*primary_text,
+ const gchar
*secondary_text,
+ const gchar
*accept_button_text);
+
+gint gtkpod_confirmation_hig (GtkWindow *parent,
+ GtkMessageType icon,
+ const gchar
*primary_text,
+ const gchar
*secondary_text,
+ const gchar
*accept_button_text,
+ const gchar
*cancel_button_text,
+ const gchar
*third_button_text,
+ const gchar
*help_context);
+
/* predefined IDs for use with gtkpod_confirmation() */
enum {
CONF_ID_IPOD_DIR = 0,
Modified: gtkpod/trunk/src/file_itunesdb.c
===================================================================
--- gtkpod/trunk/src/file_itunesdb.c 2007-12-18 13:49:25 UTC (rev 1841)
+++ gtkpod/trunk/src/file_itunesdb.c 2007-12-18 18:11:45 UTC (rev 1842)
@@ -862,25 +862,24 @@
itunesdb = itdb_get_itunesdb_path (mountpoint);
if (!itunesdb)
{
- gchar *str = g_strdup_printf (_("Could not find iPod directory
structure at '%s'.\nIf you are sure that the iPod is properly mounted at '%s',
gtkpod can create the directory structure for you.\n\nDo you want to create the
directory structure now?\n"), mountpoint, mountpoint);
- GtkWidget *dialog = gtk_message_dialog_new (
- GTK_WINDOW (gtkpod_window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_YES_NO,
- str);
- gint result = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- g_free (str);
+ gchar *str = g_strdup_printf (_("Could not find iPod directory
structure at '%s'.\n\nIf you are sure that the iPod is properly mounted at
'%s', it may not be initialized for use. In this case, gtkpod can initialize it
for you.\n\nDo you want to create the directory structure now?"), mountpoint,
mountpoint);
+
+ gint result = gtkpod_confirmation_simple (GTK_WINDOW
(gtkpod_window),
+
GTK_MESSAGE_WARNING,
+
_("iPod directory structure not found"),
+
str,
+
_("Create directory structure"));
+
+ g_free (str);
- if (result == GTK_RESPONSE_YES)
- {
- ok_to_load = gp_ipod_init (itdb);
- }
- else
- {
- ok_to_load = FALSE;
- }
+ if (result == GTK_RESPONSE_OK)
+ {
+ ok_to_load = gp_ipod_init (itdb);
+ }
+ else
+ {
+ ok_to_load = FALSE;
+ }
}
g_free (itunesdb);
g_free (mountpoint);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2