if (browser->news_aggregator && *browser->news_aggregator)
sokoke_spawn_program (browser->news_aggregator, uri, FALSE);
else
- {
- GtkWidget* dialog = gtk_message_dialog_new (
- GTK_WINDOW (browser), 0, GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK, "%s", _("New feed"));
- gtk_message_dialog_format_secondary_text (
- GTK_MESSAGE_DIALOG (dialog), "%s", uri);
- gtk_widget_show (dialog);
- g_signal_connect_swapped (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), dialog);
- }
+ sokoke_message_dialog (GTK_MESSAGE_INFO, _("New feed"), uri);
}
static void
{
GtkWidget* dialog;
GtkBox* box;
- gchar* label = NULL;
- GtkWidget* button;
+ const gchar* actions[] = { "BookmarkAdd", "AddSpeedDial",
+ "AddDesktopShortcut", "AddNewsFeed" };
+ guint i;
if (!GTK_WIDGET_VISIBLE (browser))
return;
"title", _("Add a new bookmark"), NULL);
box = GTK_BOX (GTK_DIALOG (dialog)->vbox);
- action = _action_by_name (browser, "BookmarkAdd");
- katze_assign (label, katze_object_get_string (action, "label"));
- button = gtk_button_new_with_mnemonic (label);
- gtk_box_pack_start (box, button, TRUE, TRUE, 4);
- gtk_action_connect_proxy (action, button);
- action = _action_by_name (browser, "AddSpeedDial");
- katze_assign (label, katze_object_get_string (action, "label"));
- button = gtk_button_new_with_mnemonic (label);
- gtk_box_pack_start (box, button, TRUE, TRUE, 4);
- gtk_action_connect_proxy (action, button);
- action = _action_by_name (browser, "AddDesktopShortcut");
- katze_assign (label, katze_object_get_string (action, "label"));
- button = gtk_button_new_with_mnemonic (label);
- gtk_box_pack_start (box, button, TRUE, TRUE, 4);
- gtk_action_connect_proxy (action, button);
- action = _action_by_name (browser, "AddNewsFeed");
- katze_assign (label, katze_object_get_string (action, "label"));
- button = gtk_button_new_with_mnemonic (label);
- gtk_box_pack_start (box, button, TRUE, TRUE, 4);
- gtk_action_connect_proxy (action, button);
-
- g_free (label);
-
- gtk_dialog_run (GTK_DIALOG (dialog));
+ for (i = 0; i < G_N_ELEMENTS (actions); i++)
+ {
+ gchar* label;
+ GtkWidget* button;
+
+ action = _action_by_name (browser, actions[i]);
+ label = katze_object_get_string (action, "label");
+ button = gtk_button_new_with_mnemonic (label);
+ g_free (label);
+ gtk_widget_set_name (button, "GtkButton-thumb");
+ gtk_box_pack_start (box, button, TRUE, TRUE, 4);
+ gtk_action_connect_proxy (action, button);
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gtk_widget_destroy), dialog);
+ }
+
+ gtk_widget_show (dialog);
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), dialog);
}
static void
{
if (!sokoke_show_uri_with_mime_type (gtk_widget_get_screen (view),
uri, "text/plain", gtk_get_current_event_time (), &error))
- sokoke_error_dialog (_("Could not run external program."),
- error ? error->message : "");
+ sokoke_message_dialog (GTK_MESSAGE_ERROR,
+ _("Could not run external program."), error ? error->message : "");
if (error)
g_error_free (error);
g_free (text_editor);
#if HAVE_HILDON
#include <libosso.h>
+ #include <hildon/hildon.h>
#include <hildon-mime.h>
#include <hildon-uri.h>
#endif
}
void
-sokoke_error_dialog (const gchar* short_message,
- const gchar* detailed_message)
+sokoke_message_dialog (GtkMessageType message_type,
+ const gchar* short_message,
+ const gchar* detailed_message)
{
GtkWidget* dialog = gtk_message_dialog_new (
- NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", short_message);
+ NULL, 0, message_type,
+ #if HAVE_HILDON
+ GTK_BUTTONS_NONE,
+ #else
+ GTK_BUTTONS_OK,
+ #endif
+ "%s", short_message);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", detailed_message);
- gtk_widget_show (dialog);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
+ gtk_widget_show (dialog);
}
/**
osso = osso_initialize (PACKAGE_NAME, PACKAGE_VERSION, FALSE, NULL);
if (!osso)
{
- sokoke_error_dialog (_("Could not run external program."),
- "Failed to initialize libosso");
+ sokoke_message_dialog (GTK_MESSAGE_ERROR,
+ _("Could not run external program."),
+ "Failed to initialize libosso");
return FALSE;
}
if (!dbus)
{
osso_deinitialize (osso);
- sokoke_error_dialog (_("Could not run external program."),
- "Failed to get dbus connection from osso context");
+ sokoke_message_dialog (GTK_MESSAGE_ERROR,
+ _("Could not run external program."),
+ "Failed to get dbus connection from osso context");
return FALSE;
}
if (!success)
{
- sokoke_error_dialog (_("Could not run external program."),
+ sokoke_message_dialog (GTK_MESSAGE_ERROR,
+ _("Could not run external program."),
error ? error->message : "");
if (error)
g_error_free (error);
error = NULL;
if (!g_shell_parse_argv (command_ready, NULL, &argv, &error))
{
- sokoke_error_dialog (_("Could not run external program."),
- error->message);
+ sokoke_message_dialog (GTK_MESSAGE_ERROR,
+ _("Could not run external program."),
+ error->message);
g_error_free (error);
g_free (command_ready);
return FALSE;
(GSpawnFlags)G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
NULL, NULL, NULL, &error))
{
- sokoke_error_dialog (_("Could not run external program."),
- error->message);
+ sokoke_message_dialog (GTK_MESSAGE_ERROR,
+ _("Could not run external program."),
+ error->message);
g_error_free (error);
}