diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-10-17 07:25:42 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-10-17 07:25:42 +0000 |
commit | ce4e62e941cd69bf6b93b0982240854e3e8157dd (patch) | |
tree | 113e2ce59f9127ef471fc6e3da4914509b21106b /src/prefs_common_dialog.c | |
parent | 2d4514560cab30e8d856eadfaa16bff7fb6ea6b3 (diff) |
added the default browser to the option of URI command.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@654 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/prefs_common_dialog.c')
-rw-r--r-- | src/prefs_common_dialog.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/src/prefs_common_dialog.c b/src/prefs_common_dialog.c index 6b9201ca..649baa62 100644 --- a/src/prefs_common_dialog.c +++ b/src/prefs_common_dialog.c @@ -223,6 +223,8 @@ static void prefs_common_encoding_set_data_from_optmenu (PrefParam *pparam); static void prefs_common_encoding_set_optmenu (PrefParam *pparam); static void prefs_common_recv_dialog_set_data_from_optmenu (PrefParam *pparam); static void prefs_common_recv_dialog_set_optmenu (PrefParam *pparam); +static void prefs_common_uri_set_data_from_entry (PrefParam *pparam); +static void prefs_common_uri_set_entry (PrefParam *pparam); static PrefsUIData ui_data[] = { /* Receive */ @@ -423,7 +425,7 @@ static PrefsUIData ui_data[] = { /* Other */ {"uri_open_command", &other.uri_entry, - prefs_set_data_from_entry, prefs_set_entry}, + prefs_common_uri_set_data_from_entry, prefs_common_uri_set_entry}, {"print_command", &other.printcmd_entry, prefs_set_data_from_entry, prefs_set_entry}, {"ext_editor_command", &other.exteditor_entry, @@ -1998,7 +2000,7 @@ static void prefs_other_create(void) GTK_EXPAND | GTK_FILL, 0, 0, 0); gtkut_combo_set_items (GTK_COMBO (uri_combo), #ifdef G_OS_WIN32 - "", + _("(Default browser)"), #else DEFAULT_BROWSER_CMD, "mozilla-firefox '%s'", @@ -3372,6 +3374,50 @@ static void prefs_common_recv_dialog_set_optmenu(PrefParam *pparam) gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); } +static void prefs_common_uri_set_data_from_entry(PrefParam *pparam) +{ + PrefsUIData *ui_data; + gchar **str; + const gchar *entry_str; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + entry_str = gtk_entry_get_text(GTK_ENTRY(*ui_data->widget)); + + if (pparam->type == P_STRING) { + str = (gchar **)pparam->data; + g_free(*str); + + if (entry_str[0] == '\0' || + !strcmp(_("(Default browser)"), entry_str)) + *str = NULL; + else + *str = g_strdup(entry_str); + } else { + g_warning("Invalid type for URI setting\n"); + } +} + +static void prefs_common_uri_set_entry(PrefParam *pparam) +{ + PrefsUIData *ui_data; + gchar **str; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + if (pparam->type == P_STRING) { + str = (gchar **)pparam->data; + gtk_entry_set_text(GTK_ENTRY(*ui_data->widget), + *str ? *str : _("(Default browser)")); + } else { + g_warning("Invalid type for URI setting\n"); + } +} + static void prefs_common_select_folder_cb(GtkWidget *widget, gpointer data) { FolderItem *item; |