Hi all,
Here's a patch to get the gtk+/gnome fe for irssi working again.
This only "fixes" it so you can do:
/topic #channel <newtopic>
/topic <newtopic> doesn't work yet.
Comments, flames requested. (Well, maybe not flames :-).
-- DN
Daniel
--- /home/coder/z/gnome2/src/gui-channels.c Sun May 7 08:38:15 2000
+++ ./gui-channels.c Sun Jun 11 15:21:57 2000
@@ -20,18 +20,19 @@
#include "module.h"
+#include "signals.h"
+#include "windows.h"
+#include "gui-windows.h"
+#include "window-items.h"
+
#include "channels.h"
#include "server-idle.h"
#include "gui-nicklist.h"
-#if 0
-gboolean gui_channel_active(CHANNEL_REC *channel)
-{
- return CHANNEL_PARENT(channel)->active == channel &&
- WINDOW_VIEW(CHANNEL_PARENT(channel)) ==
WINDOW_GUI(CHANNEL_PARENT(channel))->active;
-}
+static gboolean signal_channel_topic_changed(CHANNEL_REC *);
+#if 0
static void window_redraw_tab(WINDOW_REC *window)
{
GtkWidget *label;
@@ -122,36 +123,6 @@
return TRUE;
}
-static gboolean signal_channel_topic_changed(CHANNEL_REC *channel)
-{
- WINDOW_REC *window;
- GString *tmp;
-
- g_return_val_if_fail(channel != NULL, FALSE);
-
- window = CHANNEL_PARENT(channel);
- if (!gui_channel_active(channel)) return TRUE;
-
- tmp = g_string_new(channel->name);
-
- if (channel->topic == NULL || *channel->topic == '\0')
- {
- /* No topic in channel */
- gtk_entry_set_text(GTK_ENTRY(WINDOW_GUI(window)->topicentry), "");
- }
- else
- {
- gtk_entry_set_text(GTK_ENTRY(WINDOW_GUI(window)->topicentry), channel->topic);
- gtk_entry_set_position(GTK_ENTRY(WINDOW_GUI(window)->topicentry), 0);
- g_string_sprintfa(tmp, " - %s", channel->topic);
- }
-
- if (window == WINDOW_GUI(window)->parent->active)
- gtk_window_set_title(GTK_WINDOW(WINDOW_GUI(window)->parent->window),
tmp->str);
- g_string_free(tmp, TRUE);
- return TRUE;
-}
-
static gboolean signal_channel_mode_changed(CHANNEL_REC *channel)
{
GUI_WINDOW_REC *gui;
@@ -268,6 +239,56 @@
}
#endif
+/* gboolean gui_channel_active(CHANNEL_REC *channel)
+ *
+ * Just say whether this channel is visiable (i.e. currently being viewed) or not
+ * and if it's the channel that has control of the topic/status/etc bars at the top
+ * for a split-window view
+ */
+gboolean gui_channel_active(CHANNEL_REC *channel, WINDOW_REC *window)
+{
+ return ( (window->active == (WI_ITEM_REC *)channel) &&
+ ((WINDOW_GUI(window))->active == WINDOW_VIEW(window)) );
+}
+
+
+/* static gboolean signal_channel_topic_changed(CHANNEL_REC *channel)
+ *
+ * We set the topic here. WINDOW_GUI(window) returns a GUI_WINDOW_REC *
+ * which we use to access the topicentry.
+ *
+ */
+static gboolean signal_channel_topic_changed(CHANNEL_REC *channel)
+{
+WINDOW_REC *window;
+GString *tmp;
+ g_return_val_if_fail(channel != NULL, FALSE);
+
+ /* CHANNEL_REC =~ WI_ITEM_REC, so one can (WI_ITEM_REC)CHANNEL_REC */
+ window = window_item_window((WI_ITEM_REC *)channel);
+
+ /* If it's not in the foreground, we'll skip updating it till redraw */
+ if (!gui_channel_active(channel, window)) return TRUE;
+
+ tmp = g_string_new(channel->name);
+
+ if (channel->topic == NULL || *channel->topic == '\0') {
+ /* No topic in channel */
+ gtk_entry_set_text(GTK_ENTRY(WINDOW_GUI(window)->topicentry), "");
+ } else {
+ gtk_entry_set_text(GTK_ENTRY(WINDOW_GUI(window)->topicentry),
+channel->topic);
+ gtk_entry_set_position(GTK_ENTRY(WINDOW_GUI(window)->topicentry), 0);
+ g_string_sprintfa(tmp, " - %s", channel->topic);
+ }
+
+ if (window == WINDOW_GUI(window)->parent->active) {
+ gtk_window_set_title(GTK_WINDOW(WINDOW_GUI(window)->parent->window),
+tmp->str);
+ }
+ g_string_free(tmp, TRUE);
+ return TRUE;
+}
+
+
void gui_channels_init(void)
{
/*signal_add("gui channel open", (SIGNAL_FUNC) signal_channel_open);
@@ -279,6 +300,8 @@
signal_add("channel topic changed", (SIGNAL_FUNC) signal_channel_topic_changed);
signal_add("channel focused", (SIGNAL_FUNC) signal_channel_focused);
signal_add("window destroyed", (SIGNAL_FUNC) signal_window_destroyed);*/
+
+ signal_add("channel topic changed", (SIGNAL_FUNC)
+signal_channel_topic_changed);
}
void gui_channels_deinit(void)