diff -r c49f6e9ea27d -r 6bc30809f7fe pidgin/gtkprefs.c --- a/pidgin/gtkprefs.c Sat Aug 29 01:11:36 2009 +0000 +++ b/pidgin/gtkprefs.c Sun Oct 30 21:53:14 2011 +0000 @@ -46,6 +46,7 @@ #include "gtkblist.h" #include "gtkconv.h" +#include "gtkconv-theme.h" #include "gtkdebug.h" #include "gtkdialogs.h" #include "gtkimhtml.h" @@ -71,26 +72,36 @@ gchar *original_name; }; -static int sound_row_sel = 0; -static GtkWidget *prefsnotebook; - +/* Main dialog */ +static GtkWidget *prefs = NULL; + +/* Notebook */ +static GtkWidget *prefsnotebook = NULL; +static int notebook_page = 0; + +/* Conversations page */ +static GtkWidget *sample_imhtml = NULL; + +/* Themes page */ +static GtkWidget *prefs_sound_themes_combo_box; +static GtkWidget *prefs_blist_themes_combo_box; +static GtkWidget *prefs_conv_themes_combo_box; +static GtkWidget *prefs_conv_variants_combo_box; +static GtkWidget *prefs_status_themes_combo_box; +static GtkWidget *prefs_smiley_themes_combo_box; + +/* Sound theme specific */ static GtkWidget *sound_entry = NULL; -static GtkListStore *smiley_theme_store = NULL; -static GtkTreeSelection *smiley_theme_sel = NULL; -static GtkWidget *prefs_proxy_frame = NULL; - -static GtkWidget *prefs = NULL; -static GtkWidget *debugbutton = NULL; -static int notebook_page = 0; -static GtkTreeRowReference *previous_smiley_row = NULL; - +static int sound_row_sel = 0; +static gboolean prefs_sound_themes_loading; + +/* These exist outside the lifetime of the prefs dialog */ static GtkListStore *prefs_sound_themes; static GtkListStore *prefs_blist_themes; +static GtkListStore *prefs_conv_themes; +static GtkListStore *prefs_conv_variants; static GtkListStore *prefs_status_icon_themes; - -static GtkWidget *prefs_sound_themes_combo_box; -static GtkWidget *prefs_blist_themes_combo_box; -static GtkWidget *prefs_status_themes_combo_box; +static GtkListStore *prefs_smiley_themes; /* * PROTOTYPES @@ -218,16 +229,8 @@ g_return_val_if_fail(menuitems != NULL, NULL); -#if 0 /* GTK_CHECK_VERSION(2,4,0) */ - if(type == PURPLE_PREF_INT) - model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); - else if(type == PURPLE_PREF_STRING) - model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); - dropdown = gtk_combo_box_new_with_model(model); -#else dropdown = gtk_option_menu_new(); menu = gtk_menu_new(); -#endif if (type == PURPLE_PREF_INT) stored_int = purple_prefs_get_int(key); @@ -335,107 +338,64 @@ /* Unregister callbacks. */ purple_prefs_disconnect_by_handle(prefs); - prefs = NULL; + /* NULL-ify globals */ sound_entry = NULL; - debugbutton = NULL; + sound_row_sel = 0; + prefs_sound_themes_loading = FALSE; + + prefs_sound_themes_combo_box = NULL; + prefs_blist_themes_combo_box = NULL; + prefs_conv_themes_combo_box = NULL; + prefs_conv_variants_combo_box = NULL; + prefs_status_themes_combo_box = NULL; + prefs_smiley_themes_combo_box = NULL; + + sample_imhtml = NULL; + notebook_page = 0; - smiley_theme_store = NULL; - if (previous_smiley_row) - gtk_tree_row_reference_free(previous_smiley_row); - previous_smiley_row = NULL; - + prefsnotebook = NULL; + prefs = NULL; +} + +static gchar * +get_theme_markup(const char *name, gboolean custom, const char *author, + const char *description) +{ + + return g_strdup_printf("%s%s%s%s%s\n%s", + name, custom ? " " : "", custom ? _("(Custom)") : "", + author != NULL ? " - " : "", author != NULL ? author : "", + description != NULL ? description : ""); } static void -smiley_sel(GtkTreeSelection *sel, GtkTreeModel *model) -{ - GtkTreeIter iter; - const char *themename; - char *description; - GValue val; - GtkTreePath *path, *oldpath; - struct smiley_theme *new_theme, *old_theme; - GtkWidget *remove_button = g_object_get_data(G_OBJECT(sel), "remove_button"); - - if (!gtk_tree_selection_get_selected(sel, &model, &iter)) { - gtk_widget_set_sensitive(remove_button, FALSE); - return; - } - - old_theme = current_smiley_theme; - val.g_type = 0; - gtk_tree_model_get_value(model, &iter, 3, &val); - path = gtk_tree_model_get_path(model, &iter); - themename = g_value_get_string(&val); - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", themename); - - gtk_widget_set_sensitive(remove_button, (strcmp(themename, "none") && - strcmp(themename, _("Default")))); - g_value_unset (&val); - - /* current_smiley_theme is set in callback for the above pref change */ - new_theme = current_smiley_theme; - description = g_strdup_printf("%s - %s\n" - "%s", - _(new_theme->name), _(new_theme->author), _(new_theme->desc)); - gtk_list_store_set(smiley_theme_store, &iter, 1, description, -1); - g_free(description); - - if (new_theme != old_theme && previous_smiley_row) { - oldpath = gtk_tree_row_reference_get_path(previous_smiley_row); - if (gtk_tree_model_get_iter(model, &iter, oldpath)) { - description = g_strdup_printf("%s - %s\n" - "%s", - _(old_theme->name), _(old_theme->author), _(old_theme->desc)); - gtk_list_store_set(smiley_theme_store, &iter, 1, - description, -1); - g_free(description); - } - gtk_tree_path_free(oldpath); - } - if (previous_smiley_row) - gtk_tree_row_reference_free(previous_smiley_row); - previous_smiley_row = gtk_tree_row_reference_new(model, path); - gtk_tree_path_free(path); -} - -static GtkTreeRowReference * -theme_refresh_theme_list(void) +smileys_refresh_theme_list(void) { GdkPixbuf *pixbuf; GSList *themes; GtkTreeIter iter; - GtkTreeRowReference *row_ref = NULL; - - if (previous_smiley_row) - gtk_tree_row_reference_free(previous_smiley_row); - previous_smiley_row = NULL; pidgin_themes_smiley_theme_probe(); if (!(themes = smiley_themes)) - return NULL; - - gtk_list_store_clear(smiley_theme_store); + return; while (themes) { struct smiley_theme *theme = themes->data; - char *description = g_strdup_printf("%s - %s\n" - "%s", - _(theme->name), _(theme->author), _(theme->desc)); - gtk_list_store_append (smiley_theme_store, &iter); + char *description = get_theme_markup(_(theme->name), FALSE, + _(theme->author), _(theme->desc)); + gtk_list_store_append(prefs_smiley_themes, &iter); /* * LEAK - Gentoo memprof thinks pixbuf is leaking here... but it * looks like it should be ok to me. Anyone know what's up? --Mark */ - pixbuf = (theme->icon ? gdk_pixbuf_new_from_file(theme->icon, NULL) : NULL); - - gtk_list_store_set(smiley_theme_store, &iter, + pixbuf = (theme->icon ? pidgin_pixbuf_new_from_file(theme->icon) : NULL); + + gtk_list_store_set(prefs_smiley_themes, &iter, 0, pixbuf, 1, description, - 2, theme->path, - 3, theme->name, + 2, theme->name, -1); if (pixbuf != NULL) @@ -443,19 +403,7 @@ g_free(description); themes = themes->next; - - /* If this is the currently selected theme, - * we will need to select it. Grab the row reference. */ - if (theme == current_smiley_theme) { - GtkTreePath *path = gtk_tree_model_get_path( - GTK_TREE_MODEL(smiley_theme_store), &iter); - row_ref = gtk_tree_row_reference_new( - GTK_TREE_MODEL(smiley_theme_store), path); - gtk_tree_path_free(path); - } } - - return row_ref; } /* Rebuild the markup for the sound theme selection for "(Custom)" themes */ @@ -463,8 +411,8 @@ pref_sound_generate_markup(void) { gboolean print_custom, customized; - const gchar *name, *author, *description, *current_theme; - gchar *markup; + const gchar *author, *description, *current_theme; + gchar *name, *markup; PurpleSoundTheme *theme; GtkTreeIter iter; @@ -475,23 +423,24 @@ do { gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &iter, 2, &name, -1); - print_custom = customized && g_str_equal(current_theme, name); - - if (!name || *name == '\0') - markup = g_strdup_printf("(Default)%s%s - None\nThe default Pidgin sound theme", - print_custom ? " " : "", print_custom ? "(Custom)" : ""); - else { + print_custom = customized && name && g_str_equal(current_theme, name); + + if (!name || *name == '\0') { + g_free(name); + name = g_strdup(_("Default")); + author = _("Penguin Pimps"); + description = _("The default Pidgin sound theme"); + } else { theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(name, "sound")); author = purple_theme_get_author(PURPLE_THEME(theme)); description = purple_theme_get_description(PURPLE_THEME(theme)); - - markup = g_strdup_printf("%s%s%s%s%s\n%s", - name, print_custom ? " " : "", print_custom ? "(Custom)" : "", - author != NULL ? " - " : "", author != NULL ? author : "", description != NULL ? description : ""); } + markup = get_theme_markup(name, print_custom, author, description); + gtk_list_store_set(prefs_sound_themes, &iter, 1, markup, -1); + g_free(name); g_free(markup); } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(prefs_sound_themes), &iter)); @@ -511,9 +460,10 @@ image_full = purple_theme_get_image_full(theme); if (image_full != NULL){ - pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); + pixbuf = pidgin_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE); g_free(image_full); - } else pixbuf = NULL; + } else + pixbuf = NULL; gtk_list_store_append(prefs_sound_themes, &iter); gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, purple_theme_get_name(theme), -1); @@ -526,20 +476,21 @@ if (PIDGIN_IS_BLIST_THEME(theme)) store = prefs_blist_themes; - else store = prefs_status_icon_themes; + else + store = prefs_status_icon_themes; image_full = purple_theme_get_image_full(theme); if (image_full != NULL){ - pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); + pixbuf = pidgin_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE); g_free(image_full); - } else pixbuf = NULL; + } else + pixbuf = NULL; name = purple_theme_get_name(theme); author = purple_theme_get_author(theme); description = purple_theme_get_description(theme); - markup = g_strdup_printf("%s%s%s\n%s", name, author != NULL ? " - " : "", - author != NULL ? author : "", description != NULL ? description : ""); + markup = get_theme_markup(name, FALSE, author, description); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, pixbuf, 1, markup, 2, name, -1); @@ -547,6 +498,18 @@ g_free(markup); if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); + + } else if (PIDGIN_IS_CONV_THEME(theme)) { + /* No image available? */ + + name = purple_theme_get_name(theme); + /* No author available */ + /* No description available */ + + markup = get_theme_markup(name, FALSE, NULL, NULL); + + gtk_list_store_append(prefs_conv_themes, &iter); + gtk_list_store_set(prefs_conv_themes, &iter, 1, markup, 2, name, -1); } } @@ -578,15 +541,16 @@ prefs_themes_refresh(void) { GdkPixbuf *pixbuf = NULL; - gchar *filename; + gchar *tmp; GtkTreeIter iter; + prefs_sound_themes_loading = TRUE; /* refresh the list of themes in the manager */ purple_theme_manager_refresh(); - filename = g_build_filename(DATADIR, "icons", "hicolor", "32x32", "apps", "pidgin.png", NULL); - pixbuf = gdk_pixbuf_new_from_file_at_scale(filename, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); - g_free(filename); + tmp = g_build_filename(DATADIR, "icons", "hicolor", "32x32", "apps", "pidgin.png", NULL); + pixbuf = pidgin_pixbuf_new_from_file_at_scale(tmp, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE); + g_free(tmp); /* sound themes */ gtk_list_store_clear(prefs_sound_themes); @@ -596,25 +560,46 @@ /* blist themes */ gtk_list_store_clear(prefs_blist_themes); gtk_list_store_append(prefs_blist_themes, &iter); - gtk_list_store_set(prefs_blist_themes, &iter, 0, pixbuf, 1, - "(Default) - None\n" - "The default Pidgin buddy list theme", 2, "", -1); + tmp = get_theme_markup(_("Default"), FALSE, _("Penguin Pimps"), + _("The default Pidgin buddy list theme")); + gtk_list_store_set(prefs_blist_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); + g_free(tmp); + + /* conversation themes */ + gtk_list_store_clear(prefs_conv_themes); + gtk_list_store_append(prefs_conv_themes, &iter); + tmp = get_theme_markup(_("Default"), FALSE, _("Penguin Pimps"), + _("The default Pidgin conversation theme")); + gtk_list_store_set(prefs_conv_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); + g_free(tmp); + + /* conversation theme variants */ + gtk_list_store_clear(prefs_conv_variants); /* status icon themes */ gtk_list_store_clear(prefs_status_icon_themes); gtk_list_store_append(prefs_status_icon_themes, &iter); - gtk_list_store_set(prefs_status_icon_themes, &iter, 0, pixbuf, 1, - "(Default) - None\n" - "The default Pidgin status icon theme", 2, "", -1); - g_object_unref(G_OBJECT(pixbuf)); + tmp = get_theme_markup(_("Default"), FALSE, _("Penguin Pimps"), + _("The default Pidgin status icon theme")); + gtk_list_store_set(prefs_status_icon_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); + g_free(tmp); + if (pixbuf) + g_object_unref(G_OBJECT(pixbuf)); + + /* smiley themes */ + gtk_list_store_clear(prefs_smiley_themes); purple_theme_manager_for_each_theme(prefs_themes_sort); pref_sound_generate_markup(); + smileys_refresh_theme_list(); /* set active */ prefs_set_active_theme_combo(prefs_sound_themes_combo_box, prefs_sound_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme")); prefs_set_active_theme_combo(prefs_blist_themes_combo_box, prefs_blist_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme")); + prefs_set_active_theme_combo(prefs_conv_themes_combo_box, prefs_conv_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme")); prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); + prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme")); + prefs_sound_themes_loading = FALSE; } /* init all the theme variables so that the themes can be sorted later and used by pref pages */ @@ -625,7 +610,13 @@ prefs_blist_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); + prefs_conv_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); + + prefs_conv_variants = gtk_list_store_new(1, G_TYPE_STRING); + prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); + + prefs_smiley_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); } static PurpleTheme * @@ -673,6 +664,17 @@ return TRUE; } +static void +free_theme_info(struct theme_info *info) +{ + if (info != NULL) { + g_free(info->type); + g_free(info->extension); + g_free(info->original_name); + g_free(info); + } +} + /* installs a theme, info is freed by function */ static void theme_install_theme(char *path, struct theme_info *info) @@ -680,38 +682,31 @@ #ifndef _WIN32 gchar *command; #endif - gchar *destdir, *tail, *type, *original_name; - GtkTreeRowReference *theme_rowref; + gchar *destdir; + const char *tail; gboolean is_smiley_theme, is_archive; PurpleTheme *theme = NULL; if (info == NULL) return; - original_name = info->original_name; - type = info->type; - /* check the extension */ - tail = info->extension ? info->extension : g_strdup(strrchr(path, '.')); + tail = info->extension ? info->extension : strrchr(path, '.'); if (!tail) { - g_free(type); - g_free(original_name); - g_free(info); + free_theme_info(info); return; - } else - g_free(info); + } is_archive = !g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz"); - g_free(tail); - /* Just to be safe */ g_strchomp(path); - if ((is_smiley_theme = g_str_equal(type, "smiley"))) + if ((is_smiley_theme = g_str_equal(info->type, "smiley"))) destdir = g_build_filename(purple_user_dir(), "smileys", NULL); - else destdir = g_build_filename(purple_user_dir(), "themes", "temp", NULL); + else + destdir = g_build_filename(purple_user_dir(), "themes", "temp", NULL); /* We'll check this just to make sure. This also lets us do something different on * other platforms, if need be */ @@ -732,15 +727,14 @@ purple_notify_error(NULL, NULL, _("Theme failed to unpack."), NULL); g_free(command); g_free(destdir); - g_free(type); - g_free(original_name); + free_theme_info(info); return; } #else - if(!winpidgin_gz_untar(path, destdir)) { + if (!winpidgin_gz_untar(path, destdir)) { + purple_notify_error(NULL, NULL, _("Theme failed to unpack."), NULL); g_free(destdir); - g_free(type); - g_free(original_name); + free_theme_info(info); return; } #endif @@ -748,25 +742,16 @@ if (is_smiley_theme) { /* just extract the folder to the smiley directory */ - theme_rowref = theme_refresh_theme_list(); - - if (theme_rowref != NULL) { - GtkTreePath *tp = gtk_tree_row_reference_get_path(theme_rowref); - - if (tp) - gtk_tree_selection_select_path(smiley_theme_sel, tp); - - gtk_tree_row_reference_free(theme_rowref); - } + prefs_themes_refresh(); } else if (is_archive) { - theme = prefs_theme_find_theme(destdir, type); + theme = prefs_theme_find_theme(destdir, info->type); if (PURPLE_IS_THEME(theme)) { /* create the location for the theme */ gchar *theme_dest = g_build_filename(purple_user_dir(), "themes", purple_theme_get_name(theme), - "purple", type, NULL); + "purple", info->type, NULL); if (!g_file_test(theme_dest, G_FILE_TEST_IS_DIR)) purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR); @@ -774,7 +759,7 @@ g_free(theme_dest); theme_dest = g_build_filename(purple_user_dir(), "themes", purple_theme_get_name(theme), - "purple", type, NULL); + "purple", info->type, NULL); /* move the entire directory to new location */ g_rename(purple_theme_get_dir(theme), theme_dest); @@ -796,9 +781,9 @@ temp_path = g_build_filename(purple_user_dir(), "themes", "temp", "sub_folder", NULL); - if (original_name != NULL) { + if (info->original_name != NULL) { /* name was changed from the original (probably a dnd) change it back before loading */ - temp_file = g_build_filename(temp_path, original_name, NULL); + temp_file = g_build_filename(temp_path, info->original_name, NULL); } else { gchar *source_name = g_path_get_basename(path); @@ -811,12 +796,12 @@ if (purple_theme_file_copy(path, temp_file)) { /* find the theme, could be in subfolder */ - theme = prefs_theme_find_theme(temp_path, type); + theme = prefs_theme_find_theme(temp_path, info->type); if (PURPLE_IS_THEME(theme)) { gchar *theme_dest = g_build_filename(purple_user_dir(), "themes", purple_theme_get_name(theme), - "purple", type, NULL); + "purple", info->type, NULL); if(!g_file_test(theme_dest, G_FILE_TEST_IS_DIR)) purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR); @@ -839,9 +824,8 @@ g_free(temp_path); } - g_free(type); - g_free(original_name); g_free(destdir); + free_theme_info(info); } static void @@ -852,8 +836,10 @@ gchar *path; size_t wc; - if ((error_message != NULL) || (len == 0)) + if ((error_message != NULL) || (len == 0)) { + free_theme_info(user_data); return; + } f = purple_mkstemp(&path, TRUE); wc = fwrite(themedata, len, 1, f); @@ -862,6 +848,7 @@ fclose(f); g_unlink(path); g_free(path); + free_theme_info(user_data); return; } fclose(f); @@ -897,6 +884,7 @@ purple_debug(PURPLE_DEBUG_ERROR, "theme dnd", "%s\n", (converr ? converr->message : "g_filename_from_uri error")); + free_theme_info(info); return; } theme_install_theme(tmp, info); @@ -904,7 +892,7 @@ } else if (!g_ascii_strncasecmp(name, "http://", 7)) { /* Oo, a web drag and drop. This is where things * will start to get interesting */ - purple_util_fetch_url(name, TRUE, NULL, FALSE, theme_got_url, info); + purple_util_fetch_url(name, TRUE, NULL, FALSE, -1, theme_got_url, info); } else if (!g_ascii_strncasecmp(name, "https://", 8)) { /* purple_util_fetch_url() doesn't support HTTPS, but we want users * to be able to drag and drop links from the SF trackers, so @@ -915,9 +903,10 @@ tmp[2] = 't'; tmp[3] = 'p'; - purple_util_fetch_url(tmp, TRUE, NULL, FALSE, theme_got_url, info); + purple_util_fetch_url(tmp, TRUE, NULL, FALSE, -1, theme_got_url, info); g_free(tmp); - } + } else + free_theme_info(info); gtk_drag_finish(dc, TRUE, FALSE, t); } @@ -927,11 +916,15 @@ /* builds a theme combo box from a list store with colums: icon preview, markup, theme name */ static GtkWidget * -prefs_build_theme_combo_box(GtkListStore *store, const gchar *current_theme, gchar *type) +prefs_build_theme_combo_box(GtkListStore *store, const char *current_theme, const char *type) { GtkCellRenderer *cell_rend; GtkWidget *combo_box; - GtkTargetEntry te[3] = {{"text/plain", 0, 0},{"text/uri-list", 0, 1},{"STRING", 0, 2}}; + GtkTargetEntry te[3] = { + {"text/plain", 0, 0}, + {"text/uri-list", 0, 1}, + {"STRING", 0, 2} + }; g_return_val_if_fail(store != NULL && current_theme != NULL, NULL); @@ -943,16 +936,14 @@ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), cell_rend, "pixbuf", 0, NULL); cell_rend = gtk_cell_renderer_text_new(); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combo_box), cell_rend, FALSE); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combo_box), cell_rend, TRUE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), cell_rend, "markup", 1, NULL); -/*#if GTK_CHECK_VERSION(2,6,0) - g_object_set(cell_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); -#endif*/ + g_object_set(cell_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_drag_dest_set(combo_box, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te, sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE); - g_signal_connect(G_OBJECT(combo_box), "drag_data_received", G_CALLBACK(theme_dnd_recv), type); + g_signal_connect(G_OBJECT(combo_box), "drag_data_received", G_CALLBACK(theme_dnd_recv), (gpointer) type); return combo_box; } @@ -966,14 +957,14 @@ gchar *new_theme; GtkTreeIter new_iter; - if(gtk_combo_box_get_active_iter(combo_box, &new_iter)) { + if(gtk_combo_box_get_active_iter(combo_box, &new_iter) && !prefs_sound_themes_loading) { gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &new_iter, 2, &new_theme, -1); purple_prefs_set_string(PIDGIN_PREFS_ROOT "/sound/theme", new_theme); /* New theme removes all customization */ - for(i=0; i < PURPLE_NUM_SOUNDS; i++){ + for(i = 0; i < PURPLE_NUM_SOUNDS; i++){ pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", pidgin_sound_get_event_option(i)); purple_prefs_set_path(pref, ""); @@ -989,6 +980,24 @@ } } +/* sets the current smiley theme */ +static void +prefs_set_smiley_theme_cb(GtkComboBox *combo_box, gpointer user_data) +{ + gchar *new_theme; + GtkTreeIter new_iter; + + if (gtk_combo_box_get_active_iter(combo_box, &new_iter)) { + + gtk_tree_model_get(GTK_TREE_MODEL(prefs_smiley_themes), &new_iter, 2, &new_theme, -1); + + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", new_theme); + pidgin_themes_smiley_themeize(sample_imhtml); + + g_free(new_theme); + } +} + /* Does same as normal sort, except "none" is sorted first */ static gint pidgin_sort_smileys (GtkTreeModel *model, @@ -999,8 +1008,8 @@ gint ret = 0; gchar *name1 = NULL, *name2 = NULL; - gtk_tree_model_get(model, a, 3, &name1, -1); - gtk_tree_model_get(model, b, 3, &name2, -1); + gtk_tree_model_get(model, a, 2, &name1, -1); + gtk_tree_model_get(model, b, 2, &name2, -1); if (name1 == NULL || name2 == NULL) { if (!(name1 == NULL && name2 == NULL)) @@ -1016,7 +1025,7 @@ ret = 1; } else { /* Neither string is "none", default to normal sort */ - ret = purple_utf8_strcasecmp(name1,name2); + ret = purple_utf8_strcasecmp(name1, name2); } g_free(name1); @@ -1025,155 +1034,249 @@ return ret; } +/* sets the current buddy list theme */ static void -request_theme_file_name_cb(gpointer data, char *theme_file_name) +prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data) { - struct theme_info *info = g_new0(struct theme_info, 1); - info->type = g_strdup("smiley"); - info->extension = NULL; - info->original_name = NULL; - - theme_install_theme(theme_file_name, info); + PidginBlistTheme *theme = NULL; + GtkTreeIter iter; + gchar *name = NULL; + + if(gtk_combo_box_get_active_iter(combo_box, &iter)) { + + gtk_tree_model_get(GTK_TREE_MODEL(prefs_blist_themes), &iter, 2, &name, -1); + + if(!name || !g_str_equal(name, "")) + theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(name, "blist")); + + g_free(name); + + pidgin_blist_set_theme(theme); + } } +/* sets the current conversation theme */ static void -add_theme_button_clicked_cb(GtkWidget *widget, gpointer user_data) +prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) { - purple_request_file(NULL, _("Install Theme"), NULL, FALSE, (GCallback)request_theme_file_name_cb, NULL, NULL, NULL, NULL, NULL); + PidginConvTheme *theme = NULL; + GtkTreeIter iter; + gchar *name = NULL; + + if (gtk_combo_box_get_active_iter(combo_box, &iter)) { + const GList *variants; + const char *current_variant; + gboolean unset = TRUE; + + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); + if (!name || !*name) { + g_free(name); + return; + } + + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/theme", name); + + /* Update list of variants */ + gtk_list_store_clear(prefs_conv_variants); + + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + current_variant = pidgin_conversation_theme_get_variant(theme); + + variants = pidgin_conversation_theme_get_variants(theme); + for (; variants && current_variant; variants = g_list_next(variants)) { + gtk_list_store_append(prefs_conv_variants, &iter); + gtk_list_store_set(prefs_conv_variants, &iter, 0, variants->data, -1); + + if (g_str_equal(variants->data, current_variant)) { + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(prefs_conv_variants_combo_box), &iter); + unset = FALSE; + } + } + + if (unset) + gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); + + g_free(name); + } } +/* sets the current conversation theme variant */ static void -remove_theme_button_clicked_cb(GtkWidget *button, GtkTreeView *tv) +prefs_set_conv_variant_cb(GtkComboBox *combo_box, gpointer user_data) { - char *theme_name = NULL, *theme_file = NULL; - GtkTreeModel *tm; - GtkTreeIter itr; - GtkTreeRowReference *trr = NULL; - - if ((tm = gtk_tree_view_get_model(tv)) == NULL) - return; - if (!gtk_tree_selection_get_selected(smiley_theme_sel, NULL, &itr)) - return; - gtk_tree_model_get(tm, &itr, 2, &theme_file, 3, &theme_name, -1); - - if (theme_file && theme_name && strcmp(theme_name, "none")) - pidgin_themes_remove_smiley_theme(theme_file); - - if ((trr = theme_refresh_theme_list()) != NULL) { - GtkTreePath *tp = gtk_tree_row_reference_get_path(trr); - - if (tp) { - gtk_tree_selection_select_path(smiley_theme_sel, tp); - gtk_tree_path_free(tp); + PidginConvTheme *theme = NULL; + GtkTreeIter iter; + gchar *name = NULL; + + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(prefs_conv_themes_combo_box), &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + g_free(name); + + if (gtk_combo_box_get_active_iter(combo_box, &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_variants), &iter, 0, &name, -1); + pidgin_conversation_theme_set_variant(theme, name); + g_free(name); } - gtk_tree_row_reference_free(trr); + } +} + +/* sets the current icon theme */ +static void +prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data) +{ + PidginStatusIconTheme *theme = NULL; + GtkTreeIter iter; + gchar *name = NULL; + + if(gtk_combo_box_get_active_iter(combo_box, &iter)) { + + gtk_tree_model_get(GTK_TREE_MODEL(prefs_status_icon_themes), &iter, 2, &name, -1); + + if(!name || !g_str_equal(name, "")) + theme = PIDGIN_STATUS_ICON_THEME(purple_theme_manager_find_theme(name, "status-icon")); + + g_free(name); + + pidgin_stock_load_status_icon_theme(theme); + pidgin_blist_refresh(purple_get_blist()); } - - g_free(theme_file); - g_free(theme_name); +} + +static GtkWidget * +add_theme_prefs_combo(GtkWidget *vbox, + GtkSizeGroup *combo_sg, GtkSizeGroup *label_sg, + GtkListStore *theme_store, + GCallback combo_box_cb, gpointer combo_box_cb_user_data, + const char *label_str, const char *prefs_path, + const char *theme_type) +{ + GtkWidget *label; + GtkWidget *combo_box = NULL; + GtkWidget *themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + + label = gtk_label_new(label_str); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_size_group_add_widget(label_sg, label); + gtk_box_pack_start(GTK_BOX(themesel_hbox), label, FALSE, FALSE, 0); + + combo_box = prefs_build_theme_combo_box(theme_store, + purple_prefs_get_string(prefs_path), + theme_type); + g_signal_connect(G_OBJECT(combo_box), "changed", + (GCallback)combo_box_cb, combo_box_cb_user_data); + gtk_size_group_add_widget(combo_sg, combo_box); + gtk_box_pack_start(GTK_BOX(themesel_hbox), combo_box, TRUE, TRUE, 0); + + gtk_box_pack_start(GTK_BOX(vbox), themesel_hbox, FALSE, FALSE, 0); + + return combo_box; +} + +static GtkWidget * +add_child_theme_prefs_combo(GtkWidget *vbox, GtkSizeGroup *combo_sg, + GtkSizeGroup *label_sg, GtkListStore *theme_store, + GCallback combo_box_cb, gpointer combo_box_cb_user_data, + const char *label_str) +{ + GtkWidget *label; + GtkWidget *combo_box; + GtkWidget *themesel_hbox; + GtkCellRenderer *cell_rend; + + themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + gtk_box_pack_start(GTK_BOX(vbox), themesel_hbox, FALSE, FALSE, 0); + + label = gtk_label_new(label_str); + gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); + gtk_size_group_add_widget(label_sg, label); + gtk_box_pack_start(GTK_BOX(themesel_hbox), label, FALSE, FALSE, 0); + + combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(theme_store)); + + cell_rend = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo_box), cell_rend, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), cell_rend, "text", 0, NULL); + g_object_set(cell_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); + + g_signal_connect(G_OBJECT(combo_box), "changed", + (GCallback)combo_box_cb, combo_box_cb_user_data); + gtk_size_group_add_widget(combo_sg, combo_box); + gtk_box_pack_start(GTK_BOX(themesel_hbox), combo_box, TRUE, TRUE, 0); + + return combo_box; } static GtkWidget * theme_page(void) { - GtkWidget *add_button, *remove_button; - GtkWidget *hbox_buttons; - GtkWidget *alignment; - GtkWidget *ret; - GtkWidget *sw; - GtkWidget *view; - GtkCellRenderer *rend; - GtkTreeViewColumn *col; - GtkTreeSelection *sel; - GtkTreeRowReference *rowref; GtkWidget *label; - GtkTargetEntry te[3] = {{"text/plain", 0, 0},{"text/uri-list", 0, 1},{"STRING", 0, 2}}; + GtkWidget *ret, *vbox; + GtkSizeGroup *label_sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); + GtkSizeGroup *combo_sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); - label = gtk_label_new(_("Select a smiley theme that you would like to use from the list below. New themes can be installed by dragging and dropping them onto the theme list.")); - - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + vbox = pidgin_make_frame(ret, _("Theme Selections")); + + /* Instructions */ + label = gtk_label_new(_("Select a theme that you would like to use from " + "the lists below.\nNew themes can be installed by " + "dragging and dropping them onto the theme list.")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(ret), label, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, FALSE, 0); gtk_widget_show(label); - sw = gtk_scrolled_window_new(NULL,NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); - - gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); - smiley_theme_store = gtk_list_store_new (4, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); - - rowref = theme_refresh_theme_list(); - - view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(smiley_theme_store)); - - gtk_drag_dest_set(view, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te, - sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE); - - g_signal_connect(G_OBJECT(view), "drag_data_received", G_CALLBACK(theme_dnd_recv), "smiley"); - - rend = gtk_cell_renderer_pixbuf_new(); - smiley_theme_sel = sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); + /* Buddy List Themes */ + prefs_blist_themes_combo_box = add_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_blist_themes, + (GCallback)prefs_set_blist_theme_cb, NULL, + _("Buddy List Theme:"), PIDGIN_PREFS_ROOT "/blist/theme", "blist"); + + /* Conversation Themes */ + prefs_conv_themes_combo_box = add_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_conv_themes, + (GCallback)prefs_set_conv_theme_cb, NULL, + _("Conversation Theme:"), PIDGIN_PREFS_ROOT "/conversations/theme", "conversation"); + + /* Conversation Theme Variants */ + prefs_conv_variants_combo_box = add_child_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_conv_variants, + (GCallback)prefs_set_conv_variant_cb, NULL, _("\tVariant:")); + + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(prefs_conv_variants), + 0, GTK_SORT_ASCENDING); + + /* Status Icon Themes */ + prefs_status_themes_combo_box = add_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_status_icon_themes, + (GCallback)prefs_set_status_icon_theme_cb, NULL, + _("Status Icon Theme:"), PIDGIN_PREFS_ROOT "/status/icon-theme", "icon"); + + /* Sound Themes */ + prefs_sound_themes_combo_box = add_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_sound_themes, + (GCallback)prefs_set_sound_theme_cb, NULL, + _("Sound Theme:"), PIDGIN_PREFS_ROOT "/sound/theme", "sound"); + + /* Smiley Themes */ + prefs_smiley_themes_combo_box = add_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_smiley_themes, + (GCallback)prefs_set_smiley_theme_cb, NULL, + _("Smiley Theme:"), PIDGIN_PREFS_ROOT "/smileys/theme", "smiley"); /* Custom sort so "none" theme is at top of list */ - gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(smiley_theme_store), - 3, pidgin_sort_smileys, NULL, NULL); - - gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(smiley_theme_store), - 3, GTK_SORT_ASCENDING); - - col = gtk_tree_view_column_new_with_attributes (_("Icon"), - rend, - "pixbuf", 0, - NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); - - rend = gtk_cell_renderer_text_new(); - col = gtk_tree_view_column_new_with_attributes (_("Description"), - rend, - "markup", 1, - NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); - g_object_unref(G_OBJECT(smiley_theme_store)); - gtk_container_add(GTK_CONTAINER(sw), view); - - g_signal_connect(G_OBJECT(sel), "changed", G_CALLBACK(smiley_sel), NULL); - - alignment = gtk_alignment_new(1.0, 0.5, 0.0, 1.0); - gtk_widget_show(alignment); - gtk_box_pack_start(GTK_BOX(ret), alignment, FALSE, TRUE, 0); - - hbox_buttons = gtk_hbox_new(TRUE, PIDGIN_HIG_CAT_SPACE); - gtk_widget_show(hbox_buttons); - gtk_container_add(GTK_CONTAINER(alignment), hbox_buttons); - - add_button = gtk_button_new_from_stock(GTK_STOCK_ADD); - gtk_widget_show(add_button); - gtk_box_pack_start(GTK_BOX(hbox_buttons), add_button, FALSE, TRUE, 0); - g_signal_connect(G_OBJECT(add_button), "clicked", (GCallback)add_theme_button_clicked_cb, view); - - remove_button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); - gtk_widget_show(remove_button); - gtk_box_pack_start(GTK_BOX(hbox_buttons), remove_button, FALSE, TRUE, 0); - g_signal_connect(G_OBJECT(remove_button), "clicked", (GCallback)remove_theme_button_clicked_cb, view); - g_object_set_data(G_OBJECT(sel), "remove_button", remove_button); - - if (rowref) { - GtkTreePath *path = gtk_tree_row_reference_get_path(rowref); - gtk_tree_row_reference_free(rowref); - gtk_tree_selection_select_path(sel, path); - gtk_tree_path_free(path); - } + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(prefs_smiley_themes), + 2, pidgin_sort_smileys, NULL, NULL); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(prefs_smiley_themes), + 2, GTK_SORT_ASCENDING); gtk_widget_show_all(ret); - pidgin_set_accessible_label (view, label); - return ret; } @@ -1371,48 +1474,6 @@ gtk_box_pack_start(GTK_BOX(vbox), checkbox, FALSE, FALSE, 0); } -/* sets the current buddy list theme */ -static void -prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data) -{ - PidginBlistTheme *theme = NULL; - GtkTreeIter iter; - gchar *name = NULL; - - if(gtk_combo_box_get_active_iter(combo_box, &iter)) { - - gtk_tree_model_get(GTK_TREE_MODEL(prefs_blist_themes), &iter, 2, &name, -1); - - if(!name || !g_str_equal(name, "")) - theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(name, "blist")); - - g_free(name); - - pidgin_blist_set_theme(theme); - } -} - -/* sets the current icon theme */ -static void -prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data) -{ - PidginStatusIconTheme *theme = NULL; - GtkTreeIter iter; - gchar *name = NULL; - - if(gtk_combo_box_get_active_iter(combo_box, &iter)) { - - gtk_tree_model_get(GTK_TREE_MODEL(prefs_status_icon_themes), &iter, 2, &name, -1); - - if(!name || !g_str_equal(name, "")) - theme = PIDGIN_STATUS_ICON_THEME(purple_theme_manager_find_theme(name, "status-icon")); - - g_free(name); - - pidgin_stock_load_status_icon_theme(theme); - } -} - static GtkWidget * interface_page(void) { @@ -1428,24 +1489,6 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - /* Buddy List Themes */ - vbox = pidgin_make_frame(ret, _("Buddy List Theme")); - - prefs_blist_themes_combo_box = prefs_build_theme_combo_box(prefs_blist_themes, - purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"), - "blist"); - - gtk_box_pack_start(GTK_BOX (vbox), prefs_blist_themes_combo_box, FALSE, FALSE, 0); - g_signal_connect(G_OBJECT(prefs_blist_themes_combo_box), "changed", (GCallback)prefs_set_blist_theme_cb, NULL); - - /* Status Icon Themes */ - prefs_status_themes_combo_box = prefs_build_theme_combo_box(prefs_status_icon_themes, - purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme"), - "icon"); - - gtk_box_pack_start(GTK_BOX (vbox), prefs_status_themes_combo_box, FALSE, FALSE, 0); - g_signal_connect(G_OBJECT(prefs_status_themes_combo_box), "changed", (GCallback)prefs_set_status_icon_theme_cb, NULL); - /* System Tray */ vbox = pidgin_make_frame(ret, _("System Tray Icon")); label = pidgin_prefs_dropdown(vbox, _("_Show system tray icon:"), PURPLE_PREF_STRING, @@ -1497,10 +1540,8 @@ _("Bottom"), GTK_POS_BOTTOM, _("Left"), GTK_POS_LEFT, _("Right"), GTK_POS_RIGHT, -#if GTK_CHECK_VERSION(2,6,0) _("Left Vertical"), GTK_POS_LEFT|8, _("Right Vertical"), GTK_POS_RIGHT|8, -#endif NULL); gtk_size_group_add_widget(sg, label); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); @@ -1521,12 +1562,29 @@ return ret; } -#if GTK_CHECK_VERSION(2,4,0) +#ifdef _WIN32 +static void +apply_custom_font(void) +{ + PangoFontDescription *desc = NULL; + if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font")) { + const char *font = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/custom_font"); + desc = pango_font_description_from_string(font); + } + + gtk_widget_modify_font(sample_imhtml, desc); + if (desc) + pango_font_description_free(desc); + +} static void pidgin_custom_font_set(GtkFontButton *font_button, gpointer nul) { + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/custom_font", gtk_font_button_get_font_name(font_button)); + + apply_custom_font(); } #endif @@ -1538,15 +1596,11 @@ GtkWidget *toolbar; GtkWidget *iconpref1; GtkWidget *iconpref2; - GtkWidget *fontpref; GtkWidget *imhtml; GtkWidget *frame; - -#if GTK_CHECK_VERSION(2,4,0) GtkWidget *hbox; - GtkWidget *font_button; - const char *font_name; -#endif + GtkWidget *checkbox; + GtkWidget *spin_button; ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); @@ -1579,18 +1633,38 @@ #ifdef _WIN32 pidgin_prefs_checkbox(_("F_lash window when IMs are received"), PIDGIN_PREFS_ROOT "/win32/blink_im", vbox); #endif + hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + + checkbox = pidgin_prefs_checkbox(_("Resize incoming custom smileys"), + PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys", hbox); + + spin_button = pidgin_prefs_labeled_spin_button(hbox, + _("Maximum size:"), + PIDGIN_PREFS_ROOT "/conversations/custom_smileys_size", + 16, 512, NULL); + + if (!purple_prefs_get_bool( + PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys")) + gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); + + g_signal_connect(G_OBJECT(checkbox), "clicked", + G_CALLBACK(pidgin_toggle_sensitive), spin_button); + + pidgin_add_widget_to_vbox(GTK_BOX(vbox), NULL, NULL, hbox, TRUE, NULL); pidgin_prefs_labeled_spin_button(vbox, _("Minimum input area height in lines:"), PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines", 1, 8, NULL); -#if GTK_CHECK_VERSION(2,4,0) +#ifdef _WIN32 + { + GtkWidget *fontpref, *font_button, *hbox; + const char *font_name; vbox = pidgin_make_frame(ret, _("Font")); - if (purple_running_gnome()) - fontpref = pidgin_prefs_checkbox(_("Use document font from _theme"), PIDGIN_PREFS_ROOT "/conversations/use_theme_font", vbox); - else - fontpref = pidgin_prefs_checkbox(_("Use font from _theme"), PIDGIN_PREFS_ROOT "/conversations/use_theme_font", vbox); + + fontpref = pidgin_prefs_checkbox(_("Use font from _theme"), + PIDGIN_PREFS_ROOT "/conversations/use_theme_font", vbox); font_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/custom_font"); if ((font_name == NULL) || (*font_name == '\0')) { @@ -1604,16 +1678,18 @@ if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font")) gtk_widget_set_sensitive(hbox, FALSE); g_signal_connect(G_OBJECT(fontpref), "clicked", G_CALLBACK(pidgin_toggle_sensitive), hbox); + g_signal_connect(G_OBJECT(fontpref), "clicked", G_CALLBACK(apply_custom_font), hbox); g_signal_connect(G_OBJECT(font_button), "font-set", G_CALLBACK(pidgin_custom_font_set), NULL); + + } #endif vbox = pidgin_make_frame(ret, _("Default Formatting")); - gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, GTK_PACK_START); frame = pidgin_create_imhtml(TRUE, &imhtml, &toolbar, NULL); gtk_widget_show(frame); gtk_widget_set_name(imhtml, "pidgin_prefs_font_imhtml"); - gtk_widget_set_size_request(frame, 300, -1); + gtk_widget_set_size_request(frame, 450, -1); gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE); gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_BOLD | @@ -1636,7 +1712,7 @@ G_CALLBACK(formatting_toggle_cb), toolbar); g_signal_connect_after(G_OBJECT(imhtml), "format_function_clear", G_CALLBACK(formatting_clear_cb), NULL); - + sample_imhtml = imhtml; gtk_widget_show(ret); @@ -1721,17 +1797,18 @@ } static void -proxy_button_clicked_cb(GtkWidget *button, gpointer null) +proxy_button_clicked_cb(GtkWidget *button, gchar *program) { GError *err = NULL; - if (g_spawn_command_line_async ("gnome-network-preferences", &err)) + if (g_spawn_command_line_async(program, &err)) return; purple_notify_error(NULL, NULL, _("Cannot start proxy configuration program."), err->message); g_error_free(err); } +#ifndef _WIN32 static void browser_button_clicked_cb(GtkWidget *button, gpointer null) { @@ -1743,20 +1820,52 @@ purple_notify_error(NULL, NULL, _("Cannot start browser configuration program."), err->message); g_error_free(err); } +#endif + +static void +auto_ip_button_clicked_cb(GtkWidget *button, gpointer null) +{ + const char *ip; + PurpleStunNatDiscovery *stun; + char *auto_ip_text; + + /* purple_network_get_my_ip will return the IP that was set by the user with + purple_network_set_public_ip, so make a lookup for the auto-detected IP + ourselves. */ + + if (purple_prefs_get_bool("/purple/network/auto_ip")) { + /* Check if STUN discovery was already done */ + stun = purple_stun_discover(NULL); + if ((stun != NULL) && (stun->status == PURPLE_STUN_STATUS_DISCOVERED)) { + ip = stun->publicip; + } else { + /* Attempt to get the IP from a NAT device using UPnP */ + ip = purple_upnp_get_public_ip(); + if (ip == NULL) { + /* Attempt to get the IP from a NAT device using NAT-PMP */ + ip = purple_pmp_get_public_ip(); + if (ip == NULL) { + /* Just fetch the IP of the local system */ + ip = purple_network_get_local_system_ip(-1); + } + } + } + } + else + ip = _("Disabled"); + + auto_ip_text = g_strdup_printf(_("Use _automatically detected IP address: %s"), ip); + gtk_button_set_label(GTK_BUTTON(button), auto_ip_text); + g_free(auto_ip_text); +} static GtkWidget * network_page(void) { GtkWidget *ret; GtkWidget *vbox, *hbox, *entry; - GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; - GtkWidget *proxy_warning = NULL, *browser_warning = NULL; - GtkWidget *proxy_button = NULL, *browser_button = NULL; + GtkWidget *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; GtkSizeGroup *sg; - PurpleProxyInfo *proxy_info = NULL; - const char *ip; - PurpleStunNatDiscovery *stun; - char *auto_ip_text; ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); @@ -1771,7 +1880,7 @@ G_CALLBACK(network_stun_server_changed_cb), NULL); gtk_widget_show(entry); - pidgin_add_widget_to_vbox(GTK_BOX(vbox), "ST_UN server:", + pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("ST_UN server:"), sg, entry, TRUE, NULL); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -1787,58 +1896,26 @@ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_container_add(GTK_CONTAINER(hbox), label); - /* purple_network_get_my_ip will return the IP that was set by the user with - purple_network_set_public_ip, so make a lookup for the auto-detected IP - ourselves. */ - - /* Check if STUN discovery was already done */ - stun = purple_stun_discover(NULL); - if ((stun != NULL) && (stun->status == PURPLE_STUN_STATUS_DISCOVERED)) { - ip = stun->publicip; - } else { - /* Attempt to get the IP from a NAT device using UPnP */ - ip = purple_upnp_get_public_ip(); - if (ip == NULL) { - /* Attempt to get the IP from a NAT device using NAT-PMP */ - ip = purple_pmp_get_public_ip(); - if (ip == NULL) { - /* Just fetch the IP of the local system */ - ip = purple_network_get_local_system_ip(-1); - } - } - } - - auto_ip_text = g_strdup_printf(_("Use _automatically detected IP address: %s"), ip); - auto_ip_checkbox = pidgin_prefs_checkbox(auto_ip_text, "/purple/network/auto_ip", vbox); - g_free(auto_ip_text); - - table = gtk_table_new(2, 2, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 0); - gtk_table_set_col_spacings(GTK_TABLE(table), 5); - gtk_table_set_row_spacings(GTK_TABLE(table), 10); - gtk_container_add(GTK_CONTAINER(vbox), table); - - label = gtk_label_new_with_mnemonic(_("Public _IP:")); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); - gtk_size_group_add_widget(sg, label); + auto_ip_checkbox = pidgin_prefs_checkbox("Use _automatically detected IP address", + "/purple/network/auto_ip", vbox); + g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", + G_CALLBACK(auto_ip_button_clicked_cb), NULL); + auto_ip_button_clicked_cb(auto_ip_checkbox, NULL); /* Update label */ entry = gtk_entry_new(); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); - gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); + gtk_entry_set_text(GTK_ENTRY(entry), purple_network_get_public_ip()); g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(network_ip_changed), NULL); - gtk_entry_set_text(GTK_ENTRY(entry), purple_network_get_public_ip()); - - pidgin_set_accessible_label(entry, label); + hbox = pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("Public _IP:"), + sg, entry, TRUE, NULL); if (purple_prefs_get_bool("/purple/network/auto_ip")) { - gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(hbox), FALSE); } g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", - G_CALLBACK(pidgin_toggle_sensitive), table); + G_CALLBACK(pidgin_toggle_sensitive), hbox); g_object_unref(sg); @@ -1848,23 +1925,27 @@ pidgin_prefs_checkbox(_("_Enable automatic router port forwarding"), "/purple/network/map_ports", vbox); - ports_checkbox = pidgin_prefs_checkbox(_("_Manually specify range of ports to listen on"), - "/purple/network/ports_range_use", vbox); - - spin_button = pidgin_prefs_labeled_spin_button(vbox, _("_Start port:"), + hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + + ports_checkbox = pidgin_prefs_checkbox(_("_Manually specify range of ports to listen on:"), + "/purple/network/ports_range_use", hbox); + + spin_button = pidgin_prefs_labeled_spin_button(hbox, _("_Start:"), "/purple/network/ports_range_start", 0, 65535, sg); if (!purple_prefs_get_bool("/purple/network/ports_range_use")) gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); g_signal_connect(G_OBJECT(ports_checkbox), "clicked", G_CALLBACK(pidgin_toggle_sensitive), spin_button); - spin_button = pidgin_prefs_labeled_spin_button(vbox, _("_End port:"), + spin_button = pidgin_prefs_labeled_spin_button(hbox, _("_End:"), "/purple/network/ports_range_end", 0, 65535, sg); if (!purple_prefs_get_bool("/purple/network/ports_range_use")) gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); g_signal_connect(G_OBJECT(ports_checkbox), "clicked", G_CALLBACK(pidgin_toggle_sensitive), spin_button); + pidgin_add_widget_to_vbox(GTK_BOX(vbox), NULL, NULL, hbox, TRUE, NULL); + g_object_unref(sg); /* TURN server */ @@ -1878,188 +1959,22 @@ G_CALLBACK(network_turn_server_changed_cb), NULL); gtk_widget_show(entry); - hbox = pidgin_add_widget_to_vbox(GTK_BOX(vbox), "_TURN server:", + hbox = pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_TURN server:"), sg, entry, TRUE, NULL); - pidgin_prefs_labeled_spin_button(hbox, _("_Port:"), + pidgin_prefs_labeled_spin_button(hbox, _("_UDP Port:"), "/purple/network/turn_port", 0, 65535, NULL); - hbox = pidgin_prefs_labeled_entry(vbox, "_Username:", + + pidgin_prefs_labeled_spin_button(hbox, _("T_CP Port:"), + "/purple/network/turn_port_tcp", 0, 65535, NULL); + + hbox = pidgin_prefs_labeled_entry(vbox, _("Use_rname:"), "/purple/network/turn_username", sg); - pidgin_prefs_labeled_password(hbox, "_Password:", + pidgin_prefs_labeled_password(hbox, _("Pass_word:"), "/purple/network/turn_password", NULL); - if (purple_running_gnome()) { - vbox = pidgin_make_frame(ret, _("Proxy Server & Browser")); - prefs_proxy_frame = gtk_vbox_new(FALSE, 0); - - proxy_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); - gtk_container_add(GTK_CONTAINER(vbox), hbox); - - label = gtk_label_new(NULL); - gtk_label_set_markup(GTK_LABEL(label), - _("Proxy configuration program was not found.")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - browser_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); - gtk_container_add(GTK_CONTAINER(vbox), hbox); - - label = gtk_label_new(NULL); - gtk_label_set_markup(GTK_LABEL(label), - _("Browser configuration program was not found.")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); - gtk_container_add(GTK_CONTAINER(vbox), hbox); - label = gtk_label_new(_("Proxy & Browser preferences are configured\n" - "in GNOME Preferences")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); - gtk_container_add(GTK_CONTAINER(vbox), hbox); - proxy_button = gtk_button_new_with_mnemonic(_("Configure _Proxy")); - g_signal_connect(G_OBJECT(proxy_button), "clicked", - G_CALLBACK(proxy_button_clicked_cb), NULL); - gtk_box_pack_start(GTK_BOX(hbox), proxy_button, FALSE, FALSE, 0); - gtk_widget_show(proxy_button); - browser_button = gtk_button_new_with_mnemonic(_("Configure _Browser")); - g_signal_connect(G_OBJECT(browser_button), "clicked", - G_CALLBACK(browser_button_clicked_cb), NULL); - gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0); - gtk_widget_show(browser_button); - } else { - vbox = pidgin_make_frame(ret, _("Proxy Server")); - prefs_proxy_frame = gtk_vbox_new(FALSE, 0); - - pidgin_prefs_dropdown(vbox, _("Proxy _type:"), PURPLE_PREF_STRING, - "/purple/proxy/type", - _("No proxy"), "none", - "SOCKS 4", "socks4", - "SOCKS 5", "socks5", - "HTTP", "http", - _("Use Environmental Settings"), "envvar", - NULL); - gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); - proxy_info = purple_global_proxy_get_info(); - - purple_prefs_connect_callback(prefs, "/purple/proxy/type", - proxy_changed_cb, prefs_proxy_frame); - - /* This is a global option that affects SOCKS4 usage even with account-specific proxy settings */ - pidgin_prefs_checkbox(_("Use remote DNS with SOCKS4 proxies"), - "/purple/proxy/socks4_remotedns", prefs_proxy_frame); - - table = gtk_table_new(4, 2, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 0); - gtk_table_set_col_spacings(GTK_TABLE(table), 5); - gtk_table_set_row_spacings(GTK_TABLE(table), 10); - gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table); - - - label = gtk_label_new_with_mnemonic(_("_Host:")); - gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); - - entry = gtk_entry_new(); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); - gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(proxy_print_option), (void *)PROXYHOST); - - if (proxy_info != NULL && purple_proxy_info_get_host(proxy_info)) - gtk_entry_set_text(GTK_ENTRY(entry), - purple_proxy_info_get_host(proxy_info)); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - pidgin_set_accessible_label (entry, label); - - label = gtk_label_new_with_mnemonic(_("_Port:")); - gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); - - entry = gtk_entry_new(); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); - gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(proxy_print_option), (void *)PROXYPORT); - - if (proxy_info != NULL && purple_proxy_info_get_port(proxy_info) != 0) { - char buf[128]; - g_snprintf(buf, sizeof(buf), "%d", - purple_proxy_info_get_port(proxy_info)); - - gtk_entry_set_text(GTK_ENTRY(entry), buf); - } - pidgin_set_accessible_label (entry, label); - - label = gtk_label_new_with_mnemonic(_("_User:")); - gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); - - entry = gtk_entry_new(); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); - gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(proxy_print_option), (void *)PROXYUSER); - - if (proxy_info != NULL && purple_proxy_info_get_username(proxy_info) != NULL) - gtk_entry_set_text(GTK_ENTRY(entry), - purple_proxy_info_get_username(proxy_info)); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - pidgin_set_accessible_label (entry, label); - - label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); - gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); - - entry = gtk_entry_new(); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); - gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); - gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); -#if !GTK_CHECK_VERSION(2,16,0) - if (gtk_entry_get_invisible_char(GTK_ENTRY(entry)) == '*') - gtk_entry_set_invisible_char(GTK_ENTRY(entry), PIDGIN_INVISIBLE_CHAR); -#endif /* Less than GTK+ 2.16 */ - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(proxy_print_option), (void *)PROXYPASS); - - if (proxy_info != NULL && purple_proxy_info_get_password(proxy_info) != NULL) - gtk_entry_set_text(GTK_ENTRY(entry), - purple_proxy_info_get_password(proxy_info)); - pidgin_set_accessible_label (entry, label); - } - gtk_widget_show_all(ret); g_object_unref(sg); - /* Only hide table if not running gnome otherwise we hide the IP address table! */ - if (!purple_running_gnome() && (proxy_info == NULL || - purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_NONE || - purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_USE_ENVVAR)) { - gtk_widget_hide(table); - } else if (purple_running_gnome()) { - gchar *path; - path = g_find_program_in_path("gnome-network-preferences"); - if (path != NULL) { - gtk_widget_set_sensitive(proxy_button, TRUE); - gtk_widget_hide(proxy_warning); - g_free(path); - } else { - gtk_widget_set_sensitive(proxy_button, FALSE); - gtk_widget_show(proxy_warning); - } - path = g_find_program_in_path("gnome-default-applications-properties"); - if (path != NULL) { - gtk_widget_set_sensitive(browser_button, TRUE); - gtk_widget_hide(browser_warning); - g_free(path); - } else { - gtk_widget_set_sensitive(browser_button, FALSE); - gtk_widget_show(browser_warning); - } - } return ret; } @@ -2070,7 +1985,7 @@ { const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); - purple_prefs_set_path(PIDGIN_PREFS_ROOT "/browsers/command", program); + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/browsers/manual_command", program); /* carry on normally */ return FALSE; @@ -2091,12 +2006,19 @@ {N_("Netscape"), "netscape"}, {N_("Mozilla"), "mozilla"}, {N_("Konqueror"), "kfmclient"}, + {N_("Google Chrome"), "google-chrome"}, + /* Do not move the line below. Code below expects gnome-open to be in + * this list immediately after xdg-open! */ {N_("Desktop Default"), "xdg-open"}, {N_("GNOME Default"), "gnome-open"}, {N_("Galeon"), "galeon"}, {N_("Firefox"), "firefox"}, {N_("Firebird"), "mozilla-firebird"}, - {N_("Epiphany"), "epiphany"} + {N_("Epiphany"), "epiphany"}, + /* Translators: please do not translate "chromium-browser" here! */ + {N_("Chromium (chromium-browser)"), "chromium-browser"}, + /* Translators: please do not translate "chrome" here! */ + {N_("Chromium (chrome)"), "chrome"} }; static const int num_possible_browsers = G_N_ELEMENTS(possible_browsers); @@ -2154,65 +2076,247 @@ static GtkWidget * browser_page(void) { - GtkWidget *ret; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *entry; + GtkWidget *ret, *vbox, *hbox, *label, *entry, *browser_button; GtkSizeGroup *sg; GList *browsers = NULL; ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); - sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); vbox = pidgin_make_frame (ret, _("Browser Selection")); - browsers = get_available_browsers(); - if (browsers != NULL) { - label = pidgin_prefs_dropdown_from_list(vbox,_("_Browser:"), PURPLE_PREF_STRING, - PIDGIN_PREFS_ROOT "/browsers/browser", - browsers); - g_list_free(browsers); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - gtk_size_group_add_widget(sg, label); - - hbox = gtk_hbox_new(FALSE, 0); - label = pidgin_prefs_dropdown(hbox, _("_Open link in:"), PURPLE_PREF_INT, - PIDGIN_PREFS_ROOT "/browsers/place", - _("Browser default"), PIDGIN_BROWSER_DEFAULT, - _("Existing window"), PIDGIN_BROWSER_CURRENT, - _("New window"), PIDGIN_BROWSER_NEW_WINDOW, - _("New tab"), PIDGIN_BROWSER_NEW_TAB, - NULL); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - gtk_size_group_add_widget(sg, label); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - - if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/browsers/browser"), "custom")) + if(purple_running_gnome()) { + gchar *path = g_find_program_in_path("gnome-default-applications-properties"); + + hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + label = gtk_label_new(_("Browser preferences are configured in GNOME preferences")); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + + if(path == NULL) { + label = gtk_label_new(NULL); + gtk_label_set_markup(GTK_LABEL(label), + _("Browser configuration program was not found.")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + } else { + browser_button = gtk_button_new_with_mnemonic(_("Configure _Browser")); + g_signal_connect(G_OBJECT(browser_button), "clicked", + G_CALLBACK(browser_button_clicked_cb), NULL); + gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0); + } + + g_free(path); + gtk_widget_show_all(ret); + } else { + sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); + + browsers = get_available_browsers(); + if (browsers != NULL) { + label = pidgin_prefs_dropdown_from_list(vbox,_("_Browser:"), PURPLE_PREF_STRING, + PIDGIN_PREFS_ROOT "/browsers/browser", + browsers); + g_list_free(browsers); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_size_group_add_widget(sg, label); + + hbox = gtk_hbox_new(FALSE, 0); + label = pidgin_prefs_dropdown(hbox, _("_Open link in:"), PURPLE_PREF_INT, + PIDGIN_PREFS_ROOT "/browsers/place", + _("Browser default"), PIDGIN_BROWSER_DEFAULT, + _("Existing window"), PIDGIN_BROWSER_CURRENT, + _("New window"), PIDGIN_BROWSER_NEW_WINDOW, + _("New tab"), PIDGIN_BROWSER_NEW_TAB, + NULL); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_size_group_add_widget(sg, label); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/browsers/browser"), "custom")) + gtk_widget_set_sensitive(hbox, FALSE); + purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/browsers/browser", + browser_changed1_cb, hbox); + } + + entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(entry), + purple_prefs_get_string(PIDGIN_PREFS_ROOT "/browsers/manual_command")); + g_signal_connect(G_OBJECT(entry), "focus-out-event", + G_CALLBACK(manual_browser_set), NULL); + hbox = pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Manual:\n(%s for URL)"), sg, entry, TRUE, NULL); + if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/browsers/browser"), "custom")) gtk_widget_set_sensitive(hbox, FALSE); purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/browsers/browser", - browser_changed1_cb, hbox); + browser_changed2_cb, hbox); + + gtk_widget_show_all(ret); + g_object_unref(sg); } - entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(entry), - purple_prefs_get_path(PIDGIN_PREFS_ROOT "/browsers/command")); - g_signal_connect(G_OBJECT(entry), "focus-out-event", - G_CALLBACK(manual_browser_set), NULL); - hbox = pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Manual:\n(%s for URL)"), sg, entry, TRUE, NULL); - if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/browsers/browser"), "custom")) - gtk_widget_set_sensitive(hbox, FALSE); - purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/browsers/browser", - browser_changed2_cb, hbox); - - gtk_widget_show_all(ret); - g_object_unref(sg); return ret; } #endif /*_WIN32*/ static GtkWidget * +proxy_page(void) +{ + GtkWidget *ret = NULL, *vbox = NULL, *hbox = NULL; + GtkWidget *table = NULL, *entry = NULL, *label = NULL, *proxy_button = NULL; + GtkWidget *prefs_proxy_frame = NULL; + PurpleProxyInfo *proxy_info; + + ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); + gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); + vbox = pidgin_make_frame(ret, _("Proxy Server")); + prefs_proxy_frame = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + + if(purple_running_gnome()) { + gchar *path = NULL; + + hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + label = gtk_label_new(_("Proxy preferences are configured in GNOME preferences")); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + + path = g_find_program_in_path("gnome-network-properties"); + if (path == NULL) + path = g_find_program_in_path("gnome-network-preferences"); + + if (path == NULL) { + label = gtk_label_new(NULL); + gtk_label_set_markup(GTK_LABEL(label), + _("Proxy configuration program was not found.")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + } else { + proxy_button = gtk_button_new_with_mnemonic(_("Configure _Proxy")); + g_signal_connect(G_OBJECT(proxy_button), "clicked", + G_CALLBACK(proxy_button_clicked_cb), + path); + gtk_box_pack_start(GTK_BOX(hbox), proxy_button, FALSE, FALSE, 0); + } + + /* NOTE: path leaks, but only when the prefs window is destroyed, + which is never */ + gtk_widget_show_all(ret); + } else { + GtkWidget *prefs_proxy_subframe = gtk_vbox_new(FALSE, 0); + + /* This is a global option that affects SOCKS4 usage even with + * account-specific proxy settings */ + pidgin_prefs_checkbox(_("Use remote _DNS with SOCKS4 proxies"), + "/purple/proxy/socks4_remotedns", prefs_proxy_frame); + gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); + + pidgin_prefs_dropdown(prefs_proxy_frame, _("Proxy t_ype:"), PURPLE_PREF_STRING, + "/purple/proxy/type", + _("No proxy"), "none", + _("SOCKS 4"), "socks4", + _("SOCKS 5"), "socks5", + _("Tor/Privacy (SOCKS5)"), "tor", + _("HTTP"), "http", + _("Use Environmental Settings"), "envvar", + NULL); + gtk_box_pack_start(GTK_BOX(prefs_proxy_frame), prefs_proxy_subframe, 0, 0, 0); + proxy_info = purple_global_proxy_get_info(); + + gtk_widget_show_all(ret); + + purple_prefs_connect_callback(prefs, "/purple/proxy/type", + proxy_changed_cb, prefs_proxy_subframe); + + table = gtk_table_new(4, 2, FALSE); + gtk_container_set_border_width(GTK_CONTAINER(table), 0); + gtk_table_set_col_spacings(GTK_TABLE(table), 5); + gtk_table_set_row_spacings(GTK_TABLE(table), 10); + gtk_container_add(GTK_CONTAINER(prefs_proxy_subframe), table); + + label = gtk_label_new_with_mnemonic(_("_Host:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); + + entry = gtk_entry_new(); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(proxy_print_option), (void *)PROXYHOST); + + if (proxy_info != NULL && purple_proxy_info_get_host(proxy_info)) + gtk_entry_set_text(GTK_ENTRY(entry), + purple_proxy_info_get_host(proxy_info)); + + hbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + pidgin_set_accessible_label (entry, label); + + label = gtk_label_new_with_mnemonic(_("P_ort:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); + + entry = gtk_spin_button_new_with_range(0, 65535, 1); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(proxy_print_option), (void *)PROXYPORT); + + if (proxy_info != NULL && purple_proxy_info_get_port(proxy_info) != 0) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(entry), + purple_proxy_info_get_port(proxy_info)); + } + pidgin_set_accessible_label (entry, label); + + label = gtk_label_new_with_mnemonic(_("User_name:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); + + entry = gtk_entry_new(); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(proxy_print_option), (void *)PROXYUSER); + + if (proxy_info != NULL && purple_proxy_info_get_username(proxy_info) != NULL) + gtk_entry_set_text(GTK_ENTRY(entry), + purple_proxy_info_get_username(proxy_info)); + + hbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + pidgin_set_accessible_label (entry, label); + + label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); + gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); + gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); + + entry = gtk_entry_new(); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); + gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); + gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); +#if !GTK_CHECK_VERSION(2,16,0) + if (gtk_entry_get_invisible_char(GTK_ENTRY(entry)) == '*') + gtk_entry_set_invisible_char(GTK_ENTRY(entry), PIDGIN_INVISIBLE_CHAR); +#endif /* Less than GTK+ 2.16 */ + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(proxy_print_option), (void *)PROXYPASS); + + if (proxy_info != NULL && purple_proxy_info_get_password(proxy_info) != NULL) + gtk_entry_set_text(GTK_ENTRY(entry), + purple_proxy_info_get_password(proxy_info)); + pidgin_set_accessible_label (entry, label); + + proxy_changed_cb("/purple/proxy/type", PURPLE_PREF_STRING, + purple_prefs_get_string("/purple/proxy/type"), + prefs_proxy_subframe); + + } + + return ret; +} + +static GtkWidget * logging_page(void) { GtkWidget *ret; @@ -2357,6 +2461,7 @@ gtk_widget_set_sensitive(hbox, !strcmp(method, "automatic") || + !strcmp(method, "alsa") || !strcmp(method, "esd")); } #endif /* USE_GSTREAMER */ @@ -2549,7 +2654,7 @@ sound_page(void) { GtkWidget *ret; - GtkWidget *vbox, *sw, *button; + GtkWidget *vbox, *vbox2, *sw, *button; GtkSizeGroup *sg; GtkTreeIter iter; GtkWidget *event_view; @@ -2573,9 +2678,13 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); + vbox2 = pidgin_make_frame(ret, _("Sound Options")); + + vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + gtk_box_pack_start(GTK_BOX(vbox2), vbox, FALSE, FALSE, 0); + #ifndef _WIN32 - vbox = pidgin_make_frame (ret, _("Sound Method")); - dd = pidgin_prefs_dropdown(vbox, _("_Method:"), PURPLE_PREF_STRING, + dd = pidgin_prefs_dropdown(vbox2, _("_Method:"), PURPLE_PREF_STRING, PIDGIN_PREFS_ROOT "/sound/method", _("Console beep"), "beep", #ifdef USE_GSTREAMER @@ -2605,8 +2714,6 @@ "custom")); #endif /* _WIN32 */ - vbox = pidgin_make_frame (ret, _("Sound Options")); - button = pidgin_prefs_checkbox(_("M_ute sounds"), PIDGIN_PREFS_ROOT "/sound/mute", vbox); purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/sound/mute", mute_changed_cb, button); @@ -2654,23 +2761,7 @@ gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent), vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); - /* SOUND THEMES */ - prefs_sound_themes_combo_box = prefs_build_theme_combo_box(prefs_sound_themes, - purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme"), - "sound"); - - - gtk_box_pack_start(GTK_BOX (vbox), prefs_sound_themes_combo_box, FALSE, FALSE, 0); - - g_signal_connect(G_OBJECT(prefs_sound_themes_combo_box), "changed", (GCallback)prefs_set_sound_theme_cb, NULL); - /* SOUND SELECTION */ - sw = gtk_scrolled_window_new(NULL,NULL); - gtk_widget_set_size_request(sw, -1, 100); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); - - gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); for (j=0; j < PURPLE_NUM_SOUNDS; j++) { @@ -2719,7 +2810,9 @@ NULL); gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); g_object_unref(G_OBJECT(event_store)); - gtk_container_add(GTK_CONTAINER(sw), event_view); + gtk_box_pack_start(GTK_BOX(vbox), + pidgin_make_scrollable(event_view, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, 100), + TRUE, TRUE, 0); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); @@ -2768,6 +2861,7 @@ { GtkWidget *ret; GtkWidget *vbox; + GtkWidget *hbox; GtkWidget *dd; GtkWidget *label; GtkWidget *button; @@ -2794,6 +2888,28 @@ gtk_size_group_add_widget(sg, dd); gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); + select = pidgin_prefs_labeled_spin_button(vbox, + _("_Minutes before becoming idle:"), "/purple/away/mins_before_away", + 1, 24 * 60, sg); + + hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + button = pidgin_prefs_checkbox(_("Change to this status when _idle:"), + "/purple/away/away_when_idle", hbox); + gtk_size_group_add_widget(sg, button); + + /* TODO: Show something useful if we don't have any saved statuses. */ + menu = pidgin_status_menu(purple_savedstatus_get_idleaway(), G_CALLBACK(set_idle_away)); + gtk_size_group_add_widget(sg, menu); + gtk_box_pack_start(GTK_BOX(hbox), menu, FALSE, FALSE, 0); + + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(pidgin_toggle_sensitive), menu); + + if(!purple_prefs_get_bool("/purple/away/away_when_idle")) + gtk_widget_set_sensitive(GTK_WIDGET(menu), FALSE); + /* Away stuff */ vbox = pidgin_make_frame(ret, _("Away")); @@ -2806,44 +2922,23 @@ gtk_size_group_add_widget(sg, dd); gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); - /* Auto-away stuff */ - vbox = pidgin_make_frame(ret, _("Auto-away")); - - select = pidgin_prefs_labeled_spin_button(vbox, - _("_Minutes before becoming idle:"), "/purple/away/mins_before_away", - 1, 24 * 60, sg); - - button = pidgin_prefs_checkbox(_("Change status when _idle"), - "/purple/away/away_when_idle", vbox); - - /* TODO: Show something useful if we don't have any saved statuses. */ - menu = pidgin_status_menu(purple_savedstatus_get_idleaway(), G_CALLBACK(set_idle_away)); - pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("Change _status to:"), sg, menu, TRUE, &label); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(pidgin_toggle_sensitive), menu); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(pidgin_toggle_sensitive), label); - - if (!purple_prefs_get_bool("/purple/away/away_when_idle")) { - gtk_widget_set_sensitive(GTK_WIDGET(menu), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); - } - /* Signon status stuff */ vbox = pidgin_make_frame(ret, _("Status at Startup")); button = pidgin_prefs_checkbox(_("Use status from last _exit at startup"), "/purple/savedstatus/startup_current_status", vbox); + gtk_size_group_add_widget(sg, button); /* TODO: Show something useful if we don't have any saved statuses. */ menu = pidgin_status_menu(purple_savedstatus_get_startup(), G_CALLBACK(set_startupstatus)); + gtk_size_group_add_widget(sg, menu); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(pidgin_toggle_sensitive), menu); pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("Status to a_pply at startup:"), sg, menu, TRUE, &label); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(pidgin_toggle_sensitive), label); - if (purple_prefs_get_bool("/purple/savedstatus/startup_current_status")) { + if(purple_prefs_get_bool("/purple/savedstatus/startup_current_status")) { gtk_widget_set_sensitive(GTK_WIDGET(menu), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); } @@ -2857,32 +2952,30 @@ static int prefs_notebook_add_page(const char *text, GtkWidget *page, int ind) { -#if GTK_CHECK_VERSION(2,4,0) return gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); -#else - gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); - return gtk_notebook_page_num(GTK_NOTEBOOK(prefsnotebook), page); -#endif } static void prefs_notebook_init(void) { prefs_notebook_add_page(_("Interface"), interface_page(), notebook_page++); - prefs_notebook_add_page(_("Conversations"), conv_page(), notebook_page++); - prefs_notebook_add_page(_("Smiley Themes"), theme_page(), notebook_page++); - prefs_notebook_add_page(_("Sounds"), sound_page(), notebook_page++); - prefs_notebook_add_page(_("Network"), network_page(), notebook_page++); + #ifndef _WIN32 /* We use the registered default browser in windows */ - /* if the user is running gnome 2.x or Mac OS X, hide the browsers tab */ - if ((purple_running_gnome() == FALSE) && (purple_running_osx() == FALSE)) { + /* if the user is running Mac OS X, hide the browsers tab */ + if(purple_running_osx() == FALSE) prefs_notebook_add_page(_("Browser"), browser_page(), notebook_page++); - } #endif + + prefs_notebook_add_page(_("Conversations"), conv_page(), notebook_page++); prefs_notebook_add_page(_("Logging"), logging_page(), notebook_page++); + prefs_notebook_add_page(_("Network"), network_page(), notebook_page++); + prefs_notebook_add_page(_("Proxy"), proxy_page(), notebook_page++); prefs_notebook_add_page(_("Password Storage"), keyring_page(), notebook_page++); + + prefs_notebook_add_page(_("Sounds"), sound_page(), notebook_page++); prefs_notebook_add_page(_("Status / Idle"), away_page(), notebook_page++); + prefs_notebook_add_page(_("Themes"), theme_page(), notebook_page++); } void @@ -2912,7 +3005,8 @@ /* The notebook */ prefsnotebook = notebook = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0); + gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_LEFT); + gtk_box_pack_start(GTK_BOX (vbox), notebook, FALSE, FALSE, 0); gtk_widget_show(prefsnotebook); button = pidgin_dialog_add_button(GTK_DIALOG(prefs), GTK_STOCK_CLOSE, NULL, NULL); @@ -2980,8 +3074,8 @@ /* Browsers */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/browsers"); purple_prefs_add_int(PIDGIN_PREFS_ROOT "/browsers/place", PIDGIN_BROWSER_DEFAULT); - purple_prefs_add_path(PIDGIN_PREFS_ROOT "/browsers/command", ""); - purple_prefs_add_string(PIDGIN_PREFS_ROOT "/browsers/browser", "mozilla"); + purple_prefs_add_string(PIDGIN_PREFS_ROOT "/browsers/manual_command", ""); + purple_prefs_add_string(PIDGIN_PREFS_ROOT "/browsers/browser", "xdg-open"); #endif /* Plugins */ @@ -2997,12 +3091,16 @@ /* Themes */ prefs_themes_init(); + /* Conversation Themes */ + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); + purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/theme", "Default"); + /* Smiley Themes */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/smileys"); purple_prefs_add_string(PIDGIN_PREFS_ROOT "/smileys/theme", "Default"); /* Smiley Callbacks */ - purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/smileys/theme", + purple_prefs_connect_callback(&prefs, PIDGIN_PREFS_ROOT "/smileys/theme", smiley_theme_pref_cb, NULL); pidgin_prefs_update_old(); @@ -3011,9 +3109,7 @@ void pidgin_prefs_update_old(void) { - const char *str; - - purple_prefs_rename("/gaim/gtk", PIDGIN_PREFS_ROOT); + const char *str = NULL; /* Rename some old prefs */ purple_prefs_rename(PIDGIN_PREFS_ROOT "/logging/log_ims", "/purple/logging/log_ims"); @@ -3027,11 +3123,16 @@ purple_prefs_rename_boolean_toggle(PIDGIN_PREFS_ROOT "/conversations/ignore_colors", PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting"); - /* this string pref moved into the core, try to be friendly */ - purple_prefs_rename(PIDGIN_PREFS_ROOT "/idle/reporting_method", "/purple/away/idle_reporting"); - if ((str = purple_prefs_get_string("/purple/away/idle_reporting")) && - strcmp(str, "gaim") == 0) - purple_prefs_set_string("/purple/away/idle_reporting", "purple"); + /* + * this path pref changed to a string, so migrate. I know this will break + * things for and confuse users that use multiple versions with the same + * config directory, but I'm not inclined to want to deal with that at the + * moment. -- rekkanoryo + */ + if((str = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/browsers/command")) != NULL) { + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/browsers/manual_command", str); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/browsers/command"); + } /* Remove some no-longer-used prefs */ purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/auto_expand_contacts");