[xchat-gnome] Bug 323488 - allow to customize chan/user lists position
- From: Ritesh Khadgaray <rkhadgaray src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [xchat-gnome] Bug 323488 - allow to customize chan/user lists position
- Date: Wed, 13 Jan 2010 11:36:57 +0000 (UTC)
commit 126a90925079051cac6db270f9a3416f120581a5
Author: Maia Kozheva <sikon ubuntu com>
Date: Wed Jan 13 17:00:40 2010 +0530
Bug 323488 - allow to customize chan/user lists position
data/preferences-dialog.glade | 15 +++++++++++++
data/xchat-gnome.glade | 34 +++++++++++++++++++++++++++++
src/fe-gnome/apps_xchat.schemas.in | 11 +++++++++
src/fe-gnome/main-window.c | 40 +++++++++++++++++++++++++++++++++++
src/fe-gnome/main-window.h | 1 +
src/fe-gnome/preferences-page-irc.c | 21 +++++++++++++++++-
src/fe-gnome/preferences-page-irc.h | 1 +
src/fe-gnome/userlist-gui.c | 6 ++++-
8 files changed, 127 insertions(+), 2 deletions(-)
---
diff --git a/data/preferences-dialog.glade b/data/preferences-dialog.glade
index 3f07a25..ba3568d 100644
--- a/data/preferences-dialog.glade
+++ b/data/preferences-dialog.glade
@@ -497,6 +497,21 @@
<property name="position">4</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="userlist_main">
+ <property name="label" translatable="yes">Show _user list in main window</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/data/xchat-gnome.glade b/data/xchat-gnome.glade
index 872a937..2f6e2a6 100644
--- a/data/xchat-gnome.glade
+++ b/data/xchat-gnome.glade
@@ -245,6 +245,11 @@
</packing>
</child>
<child>
+ <widget class="GtkHPaned" id="right_paned">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+
+ <child>
<widget class="GtkVBox" id="main gui vbox">
<property name="visible">True</property>
<property name="spacing">6</property>
@@ -328,6 +333,35 @@
</packing>
</child>
</widget>
+ <packing>
+ <property name="shrink">True</property>
+ <property name="resize">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow_userlist_main">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="shrink">True</property>
+ <property name="resize">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="shrink">True</property>
+ <property name="resize">True</property>
+ </packing>
</child>
</widget>
<packing>
diff --git a/src/fe-gnome/apps_xchat.schemas.in b/src/fe-gnome/apps_xchat.schemas.in
index 3147664..4ce0637 100644
--- a/src/fe-gnome/apps_xchat.schemas.in
+++ b/src/fe-gnome/apps_xchat.schemas.in
@@ -266,6 +266,17 @@
</schema>
<schema>
+ <key>/schemas/apps/xchat/main_window/userlist_in_main_window</key>
+ <applyto>/apps/xchat/main_window/userlist_in_main_window</applyto>
+ <owner>xchat</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Show user list in main window</short>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/xchat/channel_list/width</key>
<applyto>/apps/xchat/channel_list/width</applyto>
<owner>xchat</owner>
diff --git a/src/fe-gnome/main-window.c b/src/fe-gnome/main-window.c
index ad34098..b1c50f9 100644
--- a/src/fe-gnome/main-window.c
+++ b/src/fe-gnome/main-window.c
@@ -91,6 +91,8 @@ static gboolean on_main_window_window_state (GtkWidget *widget, GdkEventWindowSt
static void nickname_style_set (GtkWidget *button, GtkStyle *previous_style, gpointer data);
+static void main_window_userlist_location_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data);
+
static GtkActionEntry action_entries [] = {
/* Toplevel */
@@ -148,6 +150,7 @@ initialize_main_window (void)
GtkWidget *close, *menu_vbox, *widget;
GtkSizeGroup *group;
GtkAction *action;
+ GConfClient *client;
gui.main_window = glade_xml_get_widget (gui.xml, "xchat-gnome");
g_signal_connect (G_OBJECT (gui.main_window), "delete-event", G_CALLBACK (on_main_window_close), NULL);
@@ -233,6 +236,15 @@ initialize_main_window (void)
gtk_button_set_use_underline (GTK_BUTTON (gui.nick_button), FALSE);
g_signal_connect (G_OBJECT (gui.nick_button), "clicked", G_CALLBACK (on_nickname_clicked), NULL);
g_signal_connect (G_OBJECT (GTK_BIN (gui.nick_button)->child), "style-set", G_CALLBACK (nickname_style_set), NULL);
+
+ client = gconf_client_get_default ();
+
+ /* move userlist to main window if applicable */
+ main_window_set_show_userlist (gconf_client_get_bool (client, "/apps/xchat/main_window/userlist_in_main_window", NULL));
+
+ gconf_client_notify_add (client, "/apps/xchat/main_window/userlist_in_main_window", (GConfClientNotifyFunc) main_window_userlist_location_changed, NULL, NULL, NULL);
+
+ g_object_unref (client);
}
void
@@ -786,3 +798,31 @@ nickname_style_set (GtkWidget *button, GtkStyle *previous_style, gpointer data)
set_nickname_color (gui.current_session->server);
}
+
+static void
+main_window_userlist_location_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+{
+ GConfValue *value = gconf_entry_get_value (entry);
+ main_window_set_show_userlist (gconf_value_get_bool (value));
+}
+
+void
+main_window_set_show_userlist (gboolean show_in_main_window)
+{
+ GtkAction *discussion_users = gtk_ui_manager_get_action (gui.manager, "/menubar/DiscussionMenu/DiscussionUsers");
+
+ if (show_in_main_window)
+ {
+ gtk_widget_hide (gui.userlist_toggle);
+ gtk_widget_show (glade_xml_get_widget (gui.xml, "scrolledwindow_userlist_main"));
+ gtk_widget_reparent (GTK_WIDGET (gui.userlist), glade_xml_get_widget (gui.xml, "scrolledwindow_userlist_main"));
+ gtk_action_set_visible (discussion_users, FALSE);
+ }
+ else
+ {
+ gtk_widget_show (gui.userlist_toggle);
+ gtk_widget_hide (glade_xml_get_widget (gui.xml, "scrolledwindow_userlist_main"));
+ gtk_widget_reparent (GTK_WIDGET (gui.userlist), glade_xml_get_widget (gui.xml, "scrolledwindow_userlist"));
+ gtk_action_set_visible (discussion_users, TRUE);
+ }
+}
diff --git a/src/fe-gnome/main-window.h b/src/fe-gnome/main-window.h
index 7cb350f..32a29b9 100644
--- a/src/fe-gnome/main-window.h
+++ b/src/fe-gnome/main-window.h
@@ -30,5 +30,6 @@ void save_main_window (void);
void rename_main_window (gchar *server, gchar *channel);
void set_nickname_label (struct server *serv, char *newnick);
void set_nickname_color (struct server *serv);
+void main_window_set_show_userlist (gboolean show_in_main_window);
#endif
diff --git a/src/fe-gnome/preferences-page-irc.c b/src/fe-gnome/preferences-page-irc.c
index f490036..8f53ea2 100644
--- a/src/fe-gnome/preferences-page-irc.c
+++ b/src/fe-gnome/preferences-page-irc.c
@@ -30,6 +30,7 @@
#include "preferences-dialog.h"
#include "util.h"
#include "conversation-panel.h"
+#include "main-window.h"
G_DEFINE_TYPE(PreferencesPageIrc, preferences_page_irc, PREFERENCES_PAGE_TYPE)
@@ -265,6 +266,19 @@ show_marker_changed (GtkToggleButton *button, gpointer data)
}
}
+static void
+userlist_main_changed (GtkToggleButton *button, gpointer data)
+{
+ gboolean active;
+ GConfClient *client = gconf_client_get_default ();
+
+ active = gtk_toggle_button_get_active (button);
+ main_window_set_show_userlist (active);
+
+ gconf_client_set_bool (client, "/apps/xchat/main_window/userlist_in_main_window", active, NULL);
+ g_object_unref (client);
+}
+
PreferencesPageIrc*
preferences_page_irc_new (gpointer prefs_dialog, GtkBuilder *xml)
{
@@ -297,6 +311,7 @@ preferences_page_irc_new (gpointer prefs_dialog, GtkBuilder *xml)
GW(auto_logging);
GW(show_timestamps);
GW(show_marker);
+ GW(userlist_main);
#undef GW
GtkIconTheme *theme = gtk_icon_theme_get_default ();
@@ -316,6 +331,7 @@ preferences_page_irc_new (gpointer prefs_dialog, GtkBuilder *xml)
g_signal_connect (G_OBJECT (page->show_timestamps), "toggled", G_CALLBACK (bool_changed), "/apps/xchat/irc/showtimestamps");
g_signal_connect (G_OBJECT (page->auto_logging), "toggled", G_CALLBACK (auto_logging_changed), NULL);
g_signal_connect (G_OBJECT (page->show_marker), "toggled", G_CALLBACK (show_marker_changed), NULL);
+ g_signal_connect (G_OBJECT (page->userlist_main), "toggled", G_CALLBACK (userlist_main_changed), NULL);
g_signal_connect (G_OBJECT (page->highlight_add), "clicked", G_CALLBACK (highlight_add), page);
g_signal_connect (G_OBJECT (page->highlight_edit), "clicked", G_CALLBACK (highlight_edit), page);
g_signal_connect (G_OBJECT (page->highlight_remove), "clicked", G_CALLBACK (highlight_remove), page);
@@ -385,7 +401,10 @@ preferences_page_irc_new (gpointer prefs_dialog, GtkBuilder *xml)
toggle = gconf_client_get_bool (p->gconf, "/apps/xchat/irc/showtimestamps", NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->show_timestamps), toggle);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->auto_logging), prefs.logging);
+ toggle = gconf_client_get_bool (p->gconf, "/apps/xchat/main_window/userlist_in_main_window", NULL);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->userlist_main), toggle);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->auto_logging), prefs.logging);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->show_marker), prefs.show_marker);
/* highlight list */
page->highlight_store = gtk_list_store_new (1, G_TYPE_STRING);
diff --git a/src/fe-gnome/preferences-page-irc.h b/src/fe-gnome/preferences-page-irc.h
index b38bdf2..eca8d3c 100644
--- a/src/fe-gnome/preferences-page-irc.h
+++ b/src/fe-gnome/preferences-page-irc.h
@@ -57,6 +57,7 @@ struct _PreferencesPageIrc
GtkWidget *auto_logging;
GtkWidget *show_timestamps;
GtkWidget *show_marker;
+ GtkWidget *userlist_main;
GtkListStore *highlight_store;
GtkTreeViewColumn *highlight_column;
diff --git a/src/fe-gnome/userlist-gui.c b/src/fe-gnome/userlist-gui.c
index 75587d4..33394e9 100644
--- a/src/fe-gnome/userlist-gui.c
+++ b/src/fe-gnome/userlist-gui.c
@@ -259,6 +259,10 @@ userlist_gui_show (void)
GtkRequisition request;
GtkWidget *anchor_widget;
+ if (!gtk_widget_get_visible (gui.userlist_toggle)) {
+ return;
+ }
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gui.userlist_toggle), TRUE);
if (!GTK_WIDGET_REALIZED (gui.userlist_window)) {
@@ -363,7 +367,7 @@ userlist_window_grab_broken (GtkWidget *window, GdkEventGrabBroken *event, gpoin
static void
userlist_grab (void)
{
- if (have_grab) {
+ if (have_grab || !gtk_widget_get_visible (gui.userlist_toggle)) {
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]