Mercurial > pidgin
changeset 28583:bc2b63a14e4e
propagate from branch 'im.pidgin.cpw.rekkanoryo.prefs_window' (head 753538dd05ced6c0319b4bbabd7cac8fb6edee28)
to branch 'im.pidgin.pidgin' (head 231415df24eeb65e9310154787a07f35bda5357a)
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Tue, 17 Nov 2009 06:57:57 +0000 |
parents | 786e2ef36a2a (current diff) 36de2b72f82b (diff) |
children | 546e870dc506 |
files | |
diffstat | 4 files changed, 480 insertions(+), 632 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Tue Nov 17 04:47:18 2009 +0000 +++ b/pidgin/gtkconv.c Tue Nov 17 06:57:57 2009 +0000 @@ -7931,8 +7931,10 @@ purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/tab_side", GTK_POS_TOP); purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/scrollback_lines", 4000); +#ifdef _WIN32 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font", TRUE); purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/custom_font", ""); +#endif /* Conversations -> Chat */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/chat");
--- a/pidgin/gtkprefs.c Tue Nov 17 04:47:18 2009 +0000 +++ b/pidgin/gtkprefs.c Tue Nov 17 06:57:57 2009 +0000 @@ -74,23 +74,22 @@ static GtkWidget *prefsnotebook; 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_proxy_subframe = NULL; static GtkWidget *prefs = NULL; static GtkWidget *debugbutton = NULL; static int notebook_page = 0; -static GtkTreeRowReference *previous_smiley_row = NULL; static GtkListStore *prefs_sound_themes; static GtkListStore *prefs_blist_themes; static GtkListStore *prefs_status_icon_themes; +static GtkListStore *prefs_smiley_themes; static GtkWidget *prefs_sound_themes_combo_box; static GtkWidget *prefs_blist_themes_combo_box; static GtkWidget *prefs_status_themes_combo_box; +static GtkWidget *prefs_smiley_themes_combo_box; static gboolean prefs_sound_themes_loading; @@ -341,123 +340,6 @@ sound_entry = NULL; debugbutton = NULL; notebook_page = 0; - smiley_theme_store = NULL; - if (previous_smiley_row) - gtk_tree_row_reference_free(previous_smiley_row); - previous_smiley_row = NULL; - -} - -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("<span size='larger' weight='bold'>%s</span> - %s\n" - "<span size='smaller' foreground='white'>%s</span>", - _(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("<span size='larger' weight='bold'>%s</span> - %s\n" - "<span size='smaller' foreground='dim grey'>%s</span>", - _(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) -{ - 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); - - while (themes) { - struct smiley_theme *theme = themes->data; - char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" - "<span size='smaller' foreground='dim grey'>%s</span>", - _(theme->name), _(theme->author), _(theme->desc)); - gtk_list_store_append (smiley_theme_store, &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, - 0, pixbuf, - 1, description, - 2, theme->path, - 3, theme->name, - -1); - - if (pixbuf != NULL) - g_object_unref(G_OBJECT(pixbuf)); - - 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; } static gchar * @@ -471,6 +353,44 @@ description != NULL ? description : ""); } +static void +smileys_refresh_theme_list(void) +{ + GdkPixbuf *pixbuf; + GSList *themes; + GtkTreeIter iter; + + pidgin_themes_smiley_theme_probe(); + + if (!(themes = smiley_themes)) + return; + + while (themes) { + struct smiley_theme *theme = themes->data; + 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(prefs_smiley_themes, &iter, + 0, pixbuf, + 1, description, + 2, theme->name, + -1); + + if (pixbuf != NULL) + g_object_unref(G_OBJECT(pixbuf)); + + g_free(description); + themes = themes->next; + } +} + /* Rebuild the markup for the sound theme selection for "(Custom)" themes */ static void pref_sound_generate_markup(void) @@ -492,8 +412,8 @@ if (!name || *name == '\0') { g_free(name); - name = g_strdup(_("(Default)")); - author = _("None"); + 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")); @@ -613,7 +533,7 @@ /* blist themes */ gtk_list_store_clear(prefs_blist_themes); gtk_list_store_append(prefs_blist_themes, &iter); - tmp = get_theme_markup(_("(Default)"), FALSE, _("None"), + 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); @@ -621,20 +541,25 @@ /* status icon themes */ gtk_list_store_clear(prefs_status_icon_themes); gtk_list_store_append(prefs_status_icon_themes, &iter); - tmp = get_theme_markup(_("(Default)"), FALSE, _("None"), + 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_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; } @@ -647,6 +572,8 @@ prefs_blist_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, 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 * @@ -714,7 +641,6 @@ #endif gchar *destdir; const char *tail; - GtkTreeRowReference *theme_rowref; gboolean is_smiley_theme, is_archive; PurpleTheme *theme = NULL; @@ -773,16 +699,7 @@ 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, info->type); @@ -1022,6 +939,23 @@ } } +/* 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); + + g_free(new_theme); + } +} + /* Does same as normal sort, except "none" is sorted first */ static gint pidgin_sort_smileys (GtkTreeModel *model, @@ -1032,8 +966,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)) @@ -1049,7 +983,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); @@ -1058,158 +992,154 @@ return ret; } +/* sets the current buddy list theme */ static void -request_theme_file_name_cb(gpointer data, char *theme_file_name) -{ - struct theme_info *info = g_new0(struct theme_info, 1); - info->type = g_strdup("smiley"); - - theme_install_theme(theme_file_name, info); -} - -static void -add_theme_button_clicked_cb(GtkWidget *widget, gpointer user_data) -{ - purple_request_file(NULL, _("Install Theme"), NULL, FALSE, (GCallback)request_theme_file_name_cb, NULL, NULL, NULL, NULL, NULL); -} - -static void -remove_theme_button_clicked_cb(GtkWidget *button, GtkTreeView *tv) +prefs_set_blist_theme_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); - } - gtk_tree_row_reference_free(trr); + 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); } - - g_free(theme_file); - g_free(theme_name); +} + +/* 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()); + } } 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 *ret, *vbox; GtkWidget *label; - GtkTargetEntry te[3] = { - {"text/plain", 0, 0}, - {"text/uri-list", 0, 1}, - {"STRING", 0, 2} - }; + GtkWidget *themesel_hbox; + 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, TRUE, 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 */ + themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + + label = gtk_label_new(_("Buddy List Theme:")); + 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); + + prefs_blist_themes_combo_box = prefs_build_theme_combo_box(prefs_blist_themes, + purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"), + "blist"); + g_signal_connect(G_OBJECT(prefs_blist_themes_combo_box), "changed", + (GCallback)prefs_set_blist_theme_cb, NULL); + gtk_size_group_add_widget(combo_sg, prefs_blist_themes_combo_box); + gtk_box_pack_start(GTK_BOX(themesel_hbox), prefs_blist_themes_combo_box, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(vbox), themesel_hbox, FALSE, FALSE, 0); + + /* Status Icon Themes */ + themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + + label = gtk_label_new(_("Status Icon Theme:")); + 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); + + 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"); + g_signal_connect(G_OBJECT(prefs_status_themes_combo_box), "changed", + (GCallback)prefs_set_status_icon_theme_cb, NULL); + gtk_size_group_add_widget(combo_sg, prefs_status_themes_combo_box); + gtk_box_pack_start(GTK_BOX(themesel_hbox), prefs_status_themes_combo_box, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(vbox), themesel_hbox, FALSE, FALSE, 0); + + /* Sound Themes */ + themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + + label = gtk_label_new(_("Sound Theme:")); + 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); + + prefs_sound_themes_combo_box = prefs_build_theme_combo_box(prefs_sound_themes, + purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme"), + "sound"); + g_signal_connect(G_OBJECT(prefs_sound_themes_combo_box), "changed", + (GCallback)prefs_set_sound_theme_cb, NULL); + gtk_size_group_add_widget(combo_sg, prefs_sound_themes_combo_box); + gtk_box_pack_start(GTK_BOX(themesel_hbox), prefs_sound_themes_combo_box, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(vbox), themesel_hbox, FALSE, FALSE, 0); + + /* Smiley Themes */ + themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + + label = gtk_label_new(_("Smiley Theme:")); + 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); + + prefs_smiley_themes_combo_box = prefs_build_theme_combo_box(prefs_smiley_themes, + purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme"), + "smiley"); + g_signal_connect(G_OBJECT(prefs_smiley_themes_combo_box), "changed", + (GCallback)prefs_set_smiley_theme_cb, NULL); + gtk_size_group_add_widget(combo_sg, prefs_smiley_themes_combo_box); + gtk_box_pack_start(GTK_BOX(themesel_hbox), prefs_smiley_themes_combo_box, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(vbox), themesel_hbox, FALSE, FALSE, 0); /* 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; } @@ -1407,49 +1337,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); - pidgin_blist_refresh(purple_get_blist()); - } -} - static GtkWidget * interface_page(void) { @@ -1465,24 +1352,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, @@ -1558,15 +1427,6 @@ return ret; } -#if GTK_CHECK_VERSION(2,4,0) -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)); -} -#endif - static GtkWidget * conv_page(void) { @@ -1575,16 +1435,9 @@ 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 - ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); @@ -1622,12 +1475,11 @@ PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines", 1, 8, NULL); -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,4,0) && defined _WIN32 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')) { @@ -1758,11 +1610,11 @@ } 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); @@ -1823,12 +1675,8 @@ { GtkWidget *ret; GtkWidget *vbox, *hbox, *entry; - GtkWidget *table = NULL; GtkWidget *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; - GtkWidget *proxy_warning = NULL, *browser_warning = NULL; - GtkWidget *proxy_button = NULL, *browser_button = NULL; GtkSizeGroup *sg; - PurpleProxyInfo *proxy_info = NULL; ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); @@ -1932,180 +1780,8 @@ 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), - _("<b>Proxy configuration program was not found.</b>")); - 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), - _("<b>Browser configuration program was not found.</b>")); - 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, PIDGIN_HIG_BOX_SPACE); - 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", - "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(); - - 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) { - 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_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); - } - 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; } @@ -2200,65 +1876,244 @@ 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), + _("<b>Browser configuration program was not found.</b>")); + 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_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_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; + 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), + _("<b>Proxy configuration program was not found.</b>")); + 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 { + 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", + "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) { + 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_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); + } + + return ret; +} + +static GtkWidget * logging_page(void) { GtkWidget *ret; @@ -2521,7 +2376,7 @@ sound_page(void) { GtkWidget *ret; - GtkWidget *vbox, *sw, *button; + GtkWidget *vbox, *vbox2, *sw, *button; GtkSizeGroup *sg; GtkTreeIter iter; GtkWidget *event_view; @@ -2545,9 +2400,10 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); + vbox2 = pidgin_make_frame(ret, _("Sound Options")); + #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 @@ -2561,6 +2417,9 @@ gtk_size_group_add_widget(sg, dd); gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); + vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + gtk_box_pack_start(GTK_BOX(vbox2), vbox, FALSE, FALSE, 0); + entry = gtk_entry_new(); gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); cmd = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/sound/command"); @@ -2577,8 +2436,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); @@ -2626,16 +2483,6 @@ 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); @@ -2740,6 +2587,7 @@ { GtkWidget *ret; GtkWidget *vbox; + GtkWidget *hbox; GtkWidget *dd; GtkWidget *label; GtkWidget *button; @@ -2766,6 +2614,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")); @@ -2778,44 +2648,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); } @@ -2841,19 +2690,22 @@ 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(_("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 @@ -2883,7 +2735,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); @@ -3038,6 +2891,10 @@ purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/signon"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/silent_signon"); +#ifndef _WIN32 + purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/custom_font"); +#endif + /* Convert old queuing prefs to hide_new 3-way pref. */ if (purple_prefs_exists("/plugins/gtk/docklet/queue_messages") && purple_prefs_get_bool("/plugins/gtk/docklet/queue_messages"))
--- a/pidgin/gtkutils.c Tue Nov 17 04:47:18 2009 +0000 +++ b/pidgin/gtkutils.c Tue Nov 17 06:57:57 2009 +0000 @@ -113,26 +113,12 @@ gtk_imhtml_set_funcs(GTK_IMHTML(imhtml), >kimhtml_cbs); +#ifdef _WIN32 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); - } else if (purple_running_gnome()) { - /* Use the GNOME "document" font, if applicable */ - char *path; - - if ((path = g_find_program_in_path("gconftool-2"))) { - char *font = NULL; - char *err = NULL; - g_free(path); - if (g_spawn_command_line_sync( - "gconftool-2 -g /desktop/gnome/interface/document_font_name", - &font, &err, NULL, NULL)) { - desc = pango_font_description_from_string(font); - } - g_free(err); - g_free(font); - } } +#endif if (desc) { gtk_widget_modify_font(imhtml, desc);
--- a/pidgin/plugins/pidginrc.c Tue Nov 17 04:47:18 2009 +0000 +++ b/pidgin/plugins/pidginrc.c Tue Nov 17 06:57:57 2009 +0000 @@ -75,16 +75,19 @@ static const gchar *font_prefs[] = { "/plugins/gtk/purplerc/font/*pidgin_conv_entry", + "/plugins/gtk/purplerc/font/*pidgin_conv_imhtml", "/plugins/gtk/purplerc/font/*pidgin_request_imhtml", "/plugins/gtk/purplerc/font/*pidgin_notify_imhtml", }; static const gchar *font_prefs_set[] = { "/plugins/gtk/purplerc/set/font/*pidgin_conv_entry", + "/plugins/gtk/purplerc/set/font/*pidgin_conv_imhtml", "/plugins/gtk/purplerc/set/font/*pidgin_request_imhtml", "/plugins/gtk/purplerc/set/font/*pidgin_notify_imhtml", }; static const gchar *font_names[] = { N_("Conversation Entry"), + N_("Conversation History"), N_("Request Dialog"), N_("Notify Dialog") };