/soc/2012/tomkiewicz/gg: 8966c9ad5be9: Merge hinted string accou...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Tue Aug 14 16:26:48 EDT 2012


Changeset: 8966c9ad5be9b2913b9ea042f11cdbc3fb72890d
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2012-08-14 22:26 +0200
Branch:	 soc.2012.gg
URL: http://hg.pidgin.im/soc/2012/tomkiewicz/gg/rev/8966c9ad5be9

Description:

Merge hinted string account options from default

diffstat:

 ChangeLog                                    |   12 +
 finch/libgnt/Makefile.am                     |    2 +-
 libpurple/accountopt.c                       |   42 +-
 libpurple/accountopt.h                       |   25 +-
 libpurple/plugins/perl/common/AccountOpts.xs |    4 +-
 pidgin/gtkaccount.c                          |   31 +-
 pidgin/gtkconv.c                             |  359 ++++++-----
 pidgin/gtkconv.h                             |    1 -
 pidgin/gtkdebug.c                            |   52 +-
 pidgin/gtkdocklet.c                          |    7 +-
 pidgin/gtkdocklet.h                          |    5 +
 pidgin/gtkimhtml.c                           |    2 +
 pidgin/gtkpluginpref.c                       |    4 +-
 pidgin/gtkstatusbox.c                        |  203 +++---
 pidgin/gtkstatusbox.h                        |    6 +-
 pidgin/gtkthemes.c                           |   46 +-
 pidgin/gtkwebview.c                          |  841 ++++++++++++++++++++++++++-
 pidgin/gtkwebview.h                          |  143 ++++
 pidgin/gtkwebviewtoolbar.c                   |  153 +++-
 pidgin/gtkwebviewtoolbar.h                   |   30 +
 pidgin/plugins/perl/common/Makefile.PL.in    |    2 +-
 pidgin/plugins/vvconfig.c                    |    4 +-
 22 files changed, 1571 insertions(+), 403 deletions(-)

diffs (truncated from 3382 to 300 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
 version 3.0.0 (??/??/????):
+	Pidgin:
+	* Support building with the GTK+ 3.x toolkit.  When configuring the
+	  build, use --with-gtk=<2|3> to determine which toolkit to use.  Using
+	  either 2 or 3 will attempt to build with specifically 2.x or 3.x
+	  support.  The default is 'auto', which will first look for 3.x
+	  development headers and then 2.x development headers.
+
 	Finch:
 	* Support the conversation-extended signal for extending the
 	  conversation menu. (Howard Chu) (#14818)
@@ -47,6 +54,11 @@ version 3.0.0 (??/??/????):
 	* The Offline Message Emulation plugin now adds a note that the message
 	  was an offline message. (Flavius Anton) (#2497)
 
+version 2.10.7:
+	Gadu-Gadu:
+	* Fix a crash at startup with large contact list. Avatar support for
+	  buddies will be disabled till 3.0.0. (#15226, #14305)
+
 	MSN:
 	* Fix a crash when removing a user before its icon is loaded. (Mark
 	  Barfield) (#15217)
diff --git a/finch/libgnt/Makefile.am b/finch/libgnt/Makefile.am
--- a/finch/libgnt/Makefile.am
+++ b/finch/libgnt/Makefile.am
@@ -84,7 +84,7 @@ libgnt_lainclude_HEADERS = \
 	$(libgnt_la_headers)
 
 libgnt_la_DEPENDENCIES = 
-libgnt_la_LDFLAGS = -export-dynamic -version_info $(GNT_LT_VERSION_INFO) -no-undefined
+libgnt_la_LDFLAGS = -export-dynamic -version-info $(GNT_LT_VERSION_INFO) -no-undefined
 libgnt_la_LIBADD = \
 	$(GLIB_LIBS) \
 	$(GNT_LIBS) \
diff --git a/libpurple/accountopt.c b/libpurple/accountopt.c
--- a/libpurple/accountopt.c
+++ b/libpurple/accountopt.c
@@ -50,10 +50,17 @@ struct _PurpleAccountOption
 
 	} default_value;
 
-	gboolean masked;        /**< Whether the value entered should be
-	                         *   obscured from view (for passwords and
-	                         *   similar options)
-	                         */
+	union
+	{
+		struct
+		{
+			gboolean masked; /**< Whether the value entered should
+			                  *   be obscured from view (for
+			                  *   passwords and similar options)
+			                  */
+			GSList *hints;    /**< List of hinted values */
+		} string;
+	} params;
 };
 
 /**
@@ -177,6 +184,7 @@ purple_account_option_destroy(PurpleAcco
 	if (option->type == PURPLE_PREF_STRING)
 	{
 		g_free(option->default_value.string);
+		g_slist_free_full(option->params.string.hints, &g_free);
 	}
 	else if (option->type == PURPLE_PREF_STRING_LIST)
 	{
@@ -221,14 +229,23 @@ purple_account_option_set_default_string
 }
 
 void
-purple_account_option_set_masked(PurpleAccountOption *option, gboolean masked)
+purple_account_option_string_set_masked(PurpleAccountOption *option, gboolean masked)
 {
 	g_return_if_fail(option != NULL);
 	g_return_if_fail(option->type == PURPLE_PREF_STRING);
 
-	option->masked = masked;
+	option->params.string.masked = masked;
 }
 
+void
+purple_account_option_string_set_hints(PurpleAccountOption *option, GSList *hints)
+{
+	g_return_if_fail(option != NULL);
+	g_return_if_fail(option->type == PURPLE_PREF_STRING);
+
+	g_slist_free_full(option->params.string.hints, &g_free);
+	option->params.string.hints = hints;
+}
 
 void
 purple_account_option_set_list(PurpleAccountOption *option, GList *values)
@@ -332,12 +349,21 @@ purple_account_option_get_default_list_v
 }
 
 gboolean
-purple_account_option_get_masked(const PurpleAccountOption *option)
+purple_account_option_string_get_masked(const PurpleAccountOption *option)
 {
 	g_return_val_if_fail(option != NULL, FALSE);
 	g_return_val_if_fail(option->type == PURPLE_PREF_STRING, FALSE);
 
-	return option->masked;
+	return option->params.string.masked;
+}
+
+const GSList *
+purple_account_option_string_get_hints(const PurpleAccountOption *option)
+{
+	g_return_val_if_fail(option != NULL, FALSE);
+	g_return_val_if_fail(option->type == PURPLE_PREF_STRING, FALSE);
+
+	return option->params.string.hints;
 }
 
 GList *
diff --git a/libpurple/accountopt.h b/libpurple/accountopt.h
--- a/libpurple/accountopt.h
+++ b/libpurple/accountopt.h
@@ -158,7 +158,19 @@ void purple_account_option_set_default_s
  * @param masked The masking.
  */
 void
-purple_account_option_set_masked(PurpleAccountOption *option, gboolean masked);
+purple_account_option_string_set_masked(PurpleAccountOption *option, gboolean masked);
+
+/**
+ * Sets the hint list for an account option.
+ *
+ * The list passed will be owned by the account option, and the
+ * strings inside will be freed automatically.
+ *
+ * @param option The account option.
+ * @param hints The list of hints, stored as strings.
+ */
+void purple_account_option_string_set_hints(PurpleAccountOption *option,
+	GSList *hints);
 
 /**
  * Sets the list values for an account option.
@@ -261,7 +273,16 @@ const char *purple_account_option_get_de
  * @return %TRUE if the option's value should be obscured.
  */
 gboolean
-purple_account_option_get_masked(const PurpleAccountOption *option);
+purple_account_option_string_get_masked(const PurpleAccountOption *option);
+
+/**
+ * Returns the list of hints for an account option.
+ *
+ * @param option The account option.
+ *
+ * @constreturn A list of hints, stored as strings.
+ */
+const GSList * purple_account_option_string_get_hints(const PurpleAccountOption *option);
 
 /**
  * Returns the list values for an account option.
diff --git a/libpurple/plugins/perl/common/AccountOpts.xs b/libpurple/plugins/perl/common/AccountOpts.xs
--- a/libpurple/plugins/perl/common/AccountOpts.xs
+++ b/libpurple/plugins/perl/common/AccountOpts.xs
@@ -102,7 +102,7 @@ purple_account_option_get_type(option)
 	Purple::Account::Option option
 
 gboolean
-purple_account_option_get_masked(option)
+purple_account_option_string_get_masked(option)
 	Purple::Account::Option option
 
 int
@@ -138,7 +138,7 @@ PPCODE:
 	purple_account_option_set_list(option, t_GL);
 
 void
-purple_account_option_set_masked(option, masked)
+purple_account_option_string_set_masked(option, masked)
 	Purple::Account::Option option
 	gboolean masked
 
diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c
--- a/pidgin/gtkaccount.c
+++ b/pidgin/gtkaccount.c
@@ -812,6 +812,7 @@ add_protocol_options(AccountPrefsDialog 
 	const char *str_value;
 	gboolean bool_value;
 	ProtocolOptEntry *opt_entry;
+	const GSList *str_hints;
 
 	if (dialog->protocol_frame != NULL) {
 		gtk_notebook_remove_page (GTK_NOTEBOOK(dialog->notebook), 1);
@@ -912,8 +913,25 @@ add_protocol_options(AccountPrefsDialog 
 						purple_account_option_get_default_string(option));
 				}
 
-				opt_entry->widget = entry = gtk_entry_new();
-				if (purple_account_option_get_masked(option))
+				str_hints = purple_account_option_string_get_hints(option);
+				if (str_hints)
+				{
+					const GSList *hint_it = str_hints;
+					entry = gtk_combo_box_entry_new_text();
+					while (hint_it)
+					{
+						const gchar *hint = hint_it->data;
+						hint_it = g_list_next(hint_it);
+						gtk_combo_box_append_text(GTK_COMBO_BOX(entry), hint);
+					}
+				}
+				else
+					entry = gtk_entry_new();
+				
+				opt_entry->widget = entry;
+				if (purple_account_option_string_get_masked(option) && str_hints)
+					g_warn_if_reached();
+				else if (purple_account_option_string_get_masked(option))
 				{
 					gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
 #if !GTK_CHECK_VERSION(2,16,0)
@@ -922,7 +940,9 @@ add_protocol_options(AccountPrefsDialog 
 #endif /* Less than GTK+ 2.16 */
 				}
 
-				if (str_value != NULL)
+				if (str_value != NULL && str_hints)
+					gtk_entry_set_text(GTK_ENTRY(GTK_BIN(entry)->child), str_value);
+				else
 					gtk_entry_set_text(GTK_ENTRY(entry), str_value);
 
 				title = g_strdup_printf("_%s:",
@@ -1453,7 +1473,10 @@ ok_account_prefs_cb(GtkWidget *w, Accoun
 
 			switch (opt_entry->type) {
 				case PURPLE_PREF_STRING:
-					value = gtk_entry_get_text(GTK_ENTRY(opt_entry->widget));
+					if (GTK_IS_COMBO_BOX(opt_entry->widget))
+						value = gtk_combo_box_get_active_text(GTK_COMBO_BOX(opt_entry->widget));
+					else
+						value = gtk_entry_get_text(GTK_ENTRY(opt_entry->widget));
 					purple_account_set_string(account, opt_entry->setting, value);
 					break;
 
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -64,8 +64,6 @@
 #include "gtkconv-theme.h"
 #include "gtkconv-theme-loader.h"
 #include "gtkdialogs.h"
-#include "gtkimhtml.h"
-#include "gtkimhtmltoolbar.h"
 #include "gtklog.h"
 #include "gtkmenutray.h"
 #include "gtkpounce.h"
@@ -74,6 +72,7 @@
 #include "gtkthemes.h"
 #include "gtkutils.h"
 #include "gtkwebview.h"
+#include "gtkwebviewtoolbar.h"
 #include "pidginstock.h"
 #include "pidgintooltip.h"
 #include "smileyparser.h"
@@ -331,20 +330,24 @@ static void
 default_formatize(PidginConversation *c)
 {
 	PurpleConversation *conv = c->active_conv;
-	gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), purple_conversation_get_features(conv));
+	gtk_webview_setup_entry(GTK_WEBVIEW(c->entry), purple_conversation_get_features(conv));
 }
 
 static void
 conversation_entry_clear(PidginConversation *gtkconv)
 {
-	GtkIMHtml *imhtml = GTK_IMHTML(gtkconv->entry);
-	gtk_source_undo_manager_begin_not_undoable_action(imhtml->undo_manager);
-	gtk_imhtml_clear(imhtml);
-	gtk_source_undo_manager_end_not_undoable_action(imhtml->undo_manager);
-}
-
-static void
-clear_formatting_cb(GtkIMHtml *imhtml, PidginConversation *gtkconv)
+	GtkWebView *webview = GTK_WEBVIEW(gtkconv->entry);
+	gtk_webview_load_html_string(webview, "");
+#if 0
+	/* TODO WebKit */
+	gtk_source_undo_manager_begin_not_undoable_action(webview->undo_manager);
+	gtk_webview_clear(webview);
+	gtk_source_undo_manager_end_not_undoable_action(webview->undo_manager);
+#endif
+}
+
+static void
+clear_formatting_cb(GtkWebView *webview, PidginConversation *gtkconv)



More information about the Commits mailing list