SF.net SVN: geany: [1899] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon Sep 24 16:07:44 UTC 2007
Revision: 1899
http://geany.svn.sourceforge.net/geany/?rev=1899&view=rev
Author: ntrel
Date: 2007-09-24 09:07:44 -0700 (Mon, 24 Sep 2007)
Log Message:
-----------
Add msgwin_switch_tab(), msgwin_clear_tab() functions.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/keybindings.c
trunk/src/msgwindow.c
trunk/src/msgwindow.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-09-24 11:25:41 UTC (rev 1898)
+++ trunk/ChangeLog 2007-09-24 16:07:44 UTC (rev 1899)
@@ -3,6 +3,8 @@
* src/keybindings.c, src/editor.c, src/editor.h:
Fix bug with 'Delete lines' when cursor is at the start of a
multi-line selection.
+ * src/keybindings.c, src/msgwindow.c, src/msgwindow.h:
+ Add msgwin_switch_tab(), msgwin_clear_tab() functions.
2007-09-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2007-09-24 11:25:41 UTC (rev 1898)
+++ trunk/src/keybindings.c 2007-09-24 16:07:44 UTC (rev 1899)
@@ -42,10 +42,6 @@
#include "build.h"
#include "tools.h"
#include "navqueue.h"
-// include vte.h on non-Win32 systems, else define fake vte_init
-#ifdef HAVE_VTE
-# include "vte.h"
-#endif
const gboolean swap_alt_tab_order = FALSE;
@@ -970,9 +966,7 @@
static void cb_func_switch_scribble(G_GNUC_UNUSED guint key_id)
{
- gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_SCRATCH);
- msgwin_show_hide(TRUE);
- gtk_widget_grab_focus(lookup_widget(app->window, "textview_scribble"));
+ msgwin_switch_tab(MSG_SCRATCH, TRUE);
}
static void cb_func_switch_search_bar(G_GNUC_UNUSED guint key_id)
@@ -983,15 +977,7 @@
static void cb_func_switch_vte(G_GNUC_UNUSED guint key_id)
{
-#ifdef HAVE_VTE
- if (!vte_info.have_vte)
- return;
- msgwin_show_hide(TRUE);
- /* the msgwin must be visible before we switch to the VTE page so that
- * the font settings are applied on realization */
- gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_VTE);
- gtk_widget_grab_focus(vc->vte);
-#endif
+ msgwin_switch_tab(MSG_VTE, TRUE);
}
static void cb_func_switch_tableft(G_GNUC_UNUSED guint key_id)
Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c 2007-09-24 11:25:41 UTC (rev 1898)
+++ trunk/src/msgwindow.c 2007-09-24 16:07:44 UTC (rev 1899)
@@ -40,6 +40,7 @@
#include "filetypes.h"
#include "build.h"
#include "main.h"
+#include "vte.h"
#include <string.h>
#include <stdlib.h>
@@ -335,24 +336,9 @@
on_message_treeview_clear_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- GtkListStore *store;
+ gint tabnum = GPOINTER_TO_INT(user_data);
- switch (GPOINTER_TO_INT(user_data))
- {
- case MSG_MESSAGE:
- gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), FALSE);
- store = msgwindow.store_msg;
- break;
-
- case MSG_COMPILER:
- gtk_widget_set_sensitive(build_get_menu_items(-1)->item_next_error, FALSE);
- store = msgwindow.store_compiler;
- break;
-
- default: // MSG_STATUS
- store = msgwindow.store_status;
- }
- gtk_list_store_clear(store);
+ msgwin_clear_tab(tabnum);
}
@@ -885,3 +871,51 @@
}
+void msgwin_switch_tab(MessageWindowTabNum tabnum, gboolean show)
+{
+ GtkWidget *widget = NULL; // widget to focus
+
+ switch (tabnum)
+ {
+ case MSG_SCRATCH: widget = lookup_widget(app->window, "textview_scribble"); break;
+#ifdef HAVE_VTE
+ case MSG_VTE: widget = (vte_info.have_vte) ? vc->vte : NULL; break;
+#endif
+ default: break;
+ }
+
+ /* the msgwin must be visible before we switch to the VTE page so that
+ * the font settings are applied on realization */
+ if (show)
+ msgwin_show_hide(TRUE);
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), tabnum);
+ if (show && widget)
+ gtk_widget_grab_focus(widget);
+}
+
+
+void msgwin_clear_tab(MessageWindowTabNum tabnum)
+{
+ GtkListStore *store = NULL;
+
+ switch (tabnum)
+ {
+ case MSG_MESSAGE:
+ gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), FALSE);
+ store = msgwindow.store_msg;
+ break;
+
+ case MSG_COMPILER:
+ gtk_widget_set_sensitive(build_get_menu_items(-1)->item_next_error, FALSE);
+ store = msgwindow.store_compiler;
+ break;
+
+ case MSG_STATUS: store = msgwindow.store_status; break;
+ default: return;
+ }
+ if (store == NULL)
+ return;
+ gtk_list_store_clear(store);
+}
+
+
Modified: trunk/src/msgwindow.h
===================================================================
--- trunk/src/msgwindow.h 2007-09-24 11:25:41 UTC (rev 1898)
+++ trunk/src/msgwindow.h 2007-09-24 16:07:44 UTC (rev 1899)
@@ -34,14 +34,14 @@
COLOR_BLUE
};
-enum
+typedef enum
{
MSG_STATUS = 0, // force it to start at 0 to keep in sync with the notebook page numbers
MSG_COMPILER,
MSG_MESSAGE,
MSG_SCRATCH,
MSG_VTE,
-};
+} MessageWindowTabNum;
@@ -69,7 +69,11 @@
void msgwin_show_hide(gboolean show);
+void msgwin_switch_tab(MessageWindowTabNum tabnum, gboolean show);
+void msgwin_clear_tab(MessageWindowTabNum tabnum);
+
+
void msgwin_msg_add_fmt(gint msg_color, gint line, gint idx, const gchar *format, ...) G_GNUC_PRINTF (4, 5);
void msgwin_msg_add(gint msg_color, gint line, gint idx, const gchar *string);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list