From e5574c03936d59e2fc0077fcad318ad008c09d92 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 24 Jul 2009 13:19:27 +0200 Subject: Accept gibing NULL widget to empathy_url_show() --- libempathy-gtk/empathy-ui-utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 2218533f5..8114cc21e 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1363,7 +1363,7 @@ empathy_url_show (GtkWidget *parent, gchar *real_url; GError *error = NULL; - g_return_if_fail (GTK_IS_WIDGET (parent)); + g_return_if_fail (parent == NULL || GTK_IS_WIDGET (parent)); g_return_if_fail (url != NULL); real_url = fixup_url (url); @@ -1371,7 +1371,7 @@ empathy_url_show (GtkWidget *parent, url = real_url; } - gtk_show_uri (gtk_widget_get_screen (parent), url, + gtk_show_uri (parent ? gtk_widget_get_screen (parent) : NULL, url, gtk_get_current_event_time (), &error); if (error) { -- cgit v1.2.3 From e6b82c8297942483750028db51846180e225e35d Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 24 Jul 2009 13:20:02 +0200 Subject: Init flags to 0 to make sure it is never undefined --- libempathy-gtk/empathy-contact-list-store.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index a4c1d7ab9..ea386e14a 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -858,7 +858,7 @@ contact_list_store_add_contact (EmpathyContactListStore *store, GtkTreeIter iter; GList *groups = NULL, *l; TpConnection *connection; - EmpathyContactListFlags flags; + EmpathyContactListFlags flags = 0; priv = GET_PRIV (store); @@ -875,10 +875,7 @@ contact_list_store_add_contact (EmpathyContactListStore *store, if (EMPATHY_IS_CONTACT_MANAGER (priv->list)) { flags = empathy_contact_manager_get_flags_for_connection ( EMPATHY_CONTACT_MANAGER (priv->list), connection); - } else { - flags = 0; } - /* If no groups just add it at the top level. */ if (!groups) { gtk_tree_store_append (GTK_TREE_STORE (store), &iter, NULL); -- cgit v1.2.3 From f5a270ba2b59c64b37ceb730e800bb0db5991c36 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 24 Jul 2009 13:20:35 +0200 Subject: Wrap too long line. --- libempathy-gtk/empathy-contact-dialogs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c index 5636714b0..0ec8c8e3e 100644 --- a/libempathy-gtk/empathy-contact-dialogs.c +++ b/libempathy-gtk/empathy-contact-dialogs.c @@ -340,7 +340,8 @@ can_add_contact_to_account (EmpathyAccount *account, return FALSE; contact_manager = empathy_contact_manager_dup_singleton (); - result = empathy_contact_manager_get_flags_for_connection (contact_manager, connection) & EMPATHY_CONTACT_LIST_CAN_ADD; + result = empathy_contact_manager_get_flags_for_connection ( + contact_manager, connection) & EMPATHY_CONTACT_LIST_CAN_ADD; g_object_unref (contact_manager); return result; -- cgit v1.2.3 From 6b432eaf1f72dc42f0adf7bb7b60c5956d4e7cd0 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 24 Jul 2009 13:28:56 +0200 Subject: - Define EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS instead of hardcoding the gconf key everywhere. - Code cleanup in EmpathyThemeAdium --- libempathy-gtk/empathy-conf.h | 1 + libempathy-gtk/empathy-theme-adium.c | 84 ++++++++++++++++++++---------------- 2 files changed, 49 insertions(+), 36 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h index 937a4bf9c..2383a7edf 100644 --- a/libempathy-gtk/empathy-conf.h +++ b/libempathy-gtk/empathy-conf.h @@ -68,6 +68,7 @@ struct _EmpathyConfClass { #define EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED EMPATHY_PREFS_PATH "/conversation/spell_checker_enabled" #define EMPATHY_PREFS_CHAT_NICK_COMPLETION_CHAR EMPATHY_PREFS_PATH "/conversation/nick_completion_char" #define EMPATHY_PREFS_CHAT_AVATAR_IN_ICON EMPATHY_PREFS_PATH "/conversation/avatar_in_icon" +#define EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS EMPATHY_PREFS_PATH "/conversation/enable_webkit_developer_tools" #define EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS EMPATHY_PREFS_PATH "/ui/separate_chat_windows" #define EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN EMPATHY_PREFS_PATH "/ui/main_window_hidden" #define EMPATHY_PREFS_UI_AVATAR_DIRECTORY EMPATHY_PREFS_PATH "/ui/avatar_directory" diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 3fd4932a7..e9548f303 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -107,8 +107,11 @@ theme_adium_update_enable_webkit_developer_tools (EmpathyThemeAdium *theme) WebKitWebView *web_view = WEBKIT_WEB_VIEW (theme); gboolean enable_webkit_developer_tools; - if (empathy_conf_get_bool (empathy_conf_get (), "/apps/empathy/conversation/enable_webkit_developer_tools", &enable_webkit_developer_tools) == FALSE) + if (!empathy_conf_get_bool (empathy_conf_get (), + EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS, + &enable_webkit_developer_tools)) { return; + } g_object_set (G_OBJECT (webkit_web_view_get_settings (web_view)), "enable-developer-extras", @@ -885,29 +888,22 @@ theme_adium_dispose (GObject *object) static gboolean theme_adium_inspector_show_window_cb (WebKitWebInspector *inspector, - gpointer user_data) + EmpathyThemeAdium *theme) { - EmpathyThemeAdium *theme = user_data; EmpathyThemeAdiumPriv *priv = GET_PRIV (theme); - gtk_widget_show_all (priv->inspector_window); + if (priv->inspector_window) { + gtk_widget_show_all (priv->inspector_window); + } return TRUE; } static gboolean theme_adium_inspector_close_window_cb (WebKitWebInspector *inspector, - gpointer user_data) + EmpathyThemeAdium *theme) { - EmpathyThemeAdium *theme = user_data; - EmpathyThemeAdiumPriv *priv; - - /* We may be called too late - when the theme has already been - * destroyed */ - if (!theme) - return FALSE; - - priv = GET_PRIV (theme); + EmpathyThemeAdiumPriv *priv = GET_PRIV (theme); if (priv->inspector_window) { gtk_widget_hide (priv->inspector_window); @@ -918,27 +914,36 @@ theme_adium_inspector_close_window_cb (WebKitWebInspector *inspector, static WebKitWebView * theme_adium_inspect_web_view_cb (WebKitWebInspector *inspector, - WebKitWebView *web_view, - gpointer data) + WebKitWebView *web_view, + EmpathyThemeAdium *theme) { - EmpathyThemeAdiumPriv *priv = GET_PRIV (EMPATHY_THEME_ADIUM (web_view)); + EmpathyThemeAdiumPriv *priv = GET_PRIV (theme); GtkWidget *scrolled_window; GtkWidget *inspector_web_view; if (!priv->inspector_window) { + /* Create main window */ priv->inspector_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (priv->inspector_window), 800, 600); - g_signal_connect (priv->inspector_window, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); + /* Pack a scrolled window */ scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (priv->inspector_window), scrolled_window); - + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_container_add (GTK_CONTAINER (priv->inspector_window), + scrolled_window); + gtk_widget_show (scrolled_window); + + /* Pack a webview in the scrolled window. That webview will be + * used to render the inspector tool. */ inspector_web_view = webkit_web_view_new (); - gtk_container_add (GTK_CONTAINER (scrolled_window), inspector_web_view); + gtk_container_add (GTK_CONTAINER (scrolled_window), + inspector_web_view); + gtk_widget_show (scrolled_window); return WEBKIT_WEB_VIEW (inspector_web_view); } @@ -953,35 +958,42 @@ theme_adium_constructed (GObject *object) gchar *basedir_uri; const gchar *font_family = NULL; gint font_size = 0; + WebKitWebView *webkit_view = WEBKIT_WEB_VIEW (object); WebKitWebSettings *webkit_settings; + WebKitWebInspector *webkit_inspector; /* Set default settings */ font_family = tp_asv_get_string (priv->data->info, "DefaultFontFamily"); font_size = tp_asv_get_int32 (priv->data->info, "DefaultFontSize", NULL); - webkit_settings = webkit_web_settings_new (); + webkit_settings = webkit_web_view_get_settings (webkit_view); if (font_family) { - g_object_set (G_OBJECT (webkit_settings), "default-font-family", font_family, NULL); + g_object_set (webkit_settings, + "default-font-family", font_family, + NULL); } if (font_size) { - g_object_set (G_OBJECT (webkit_settings), "default-font-size", font_size, NULL); + g_object_set (webkit_settings, + "default-font-size", font_size, + NULL); } - g_signal_connect (webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (object)), "inspect-web-view", - G_CALLBACK (theme_adium_inspect_web_view_cb), NULL); - - g_signal_connect (webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (object)), "show-window", - G_CALLBACK (theme_adium_inspector_show_window_cb), object); - - g_signal_connect (webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (object)), "close-window", - G_CALLBACK (theme_adium_inspector_close_window_cb), NULL); + /* Setup webkit inspector */ + webkit_inspector = webkit_web_view_get_inspector (webkit_view); + g_signal_connect (webkit_inspector, "inspect-web-view", + G_CALLBACK (theme_adium_inspect_web_view_cb), + object); + g_signal_connect (webkit_inspector, "show-window", + G_CALLBACK (theme_adium_inspector_show_window_cb), + object); + g_signal_connect (webkit_inspector, "close-window", + G_CALLBACK (theme_adium_inspector_close_window_cb), + object); /* Load template */ basedir_uri = g_strconcat ("file://", priv->data->basedir, NULL); webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (object), priv->data->template_html, basedir_uri); - - g_object_unref (webkit_settings); g_free (basedir_uri); } @@ -1071,7 +1083,7 @@ empathy_theme_adium_init (EmpathyThemeAdium *theme) priv->notify_enable_webkit_developer_tools_id = empathy_conf_notify_add (empathy_conf_get (), - "/apps/empathy/conversation/enable_webkit_developer_tools", + EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS, theme_adium_notify_enable_webkit_developer_tools_cb, theme); -- cgit v1.2.3 From ce183d1c5407ddeae0cb31e30c687101a3f2e190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Chieffo?= <84yelo3@gmail.com> Date: Tue, 28 Jul 2009 18:12:32 +0100 Subject: Wrap text in contact label status (#589846) --- libempathy-gtk/empathy-contact-widget.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index a9a673c43..5b2e2de91 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -596,6 +596,10 @@ contact_widget_contact_setup (EmpathyContactWidget *information) { /* Setup label_status as a KludgeLabel */ information->label_status = empathy_kludge_label_new (""); + gtk_label_set_line_wrap_mode (GTK_LABEL (information->label_status), + PANGO_WRAP_WORD_CHAR); + gtk_label_set_line_wrap (GTK_LABEL (information->label_status), + TRUE); gtk_box_pack_start (GTK_BOX (information->hbox_presence), information->label_status, TRUE, TRUE, 0); gtk_widget_show (information->label_status); -- cgit v1.2.3