Kaydet (Commit) b71c227f authored tarafından Nick Treleaven's avatar Nick Treleaven

Add 'Hide Message Window' popup menu item for each window in the

message window area.
Add msgwin_menu_add_common_items().
Move remaining message window setup code to msgwin_init().


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1090 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 533d61fb
......@@ -7,6 +7,12 @@
strings.
Capitalize main window title.
Add ui_widget_modify_font_from_string().
* src/build.c, src/keybindings.c, src/msgwindow.c, src/msgwindow.h,
src/vte.c, src/main.c:
Add 'Hide Message Window' popup menu item for each window in the
message window area.
Add msgwin_menu_add_common_items().
Move remaining message window setup code to msgwin_init().
2006-12-12 Enrico Tröger <enrico.troeger@uvena.de>
......
......@@ -618,7 +618,7 @@ GPid build_run_cmd(gint idx)
// show the VTE
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_VTE);
gtk_widget_grab_focus(vc->vte);
msgwin_show();
msgwin_show_hide(TRUE);
run_info.pid = 1;
......@@ -732,7 +732,7 @@ static void show_build_result_message(gboolean failure)
if (! app->msgwindow_visible)
{
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
msgwin_show();
msgwin_show_hide(TRUE);
}
else
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(msgwindow.notebook)) != MSG_COMPILER)
......
......@@ -696,7 +696,7 @@ static void cb_func_switch_vte(G_GNUC_UNUSED guint key_id)
#ifdef HAVE_VTE
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_VTE);
gtk_widget_grab_focus(vc->vte);
msgwin_show();
msgwin_show_hide(TRUE);
#endif
}
......
......@@ -320,9 +320,6 @@ static void main_init(void)
app->undo_items[0] = lookup_widget(app->popup_menu, "undo1");
app->undo_items[1] = lookup_widget(app->window, "menu_undo2");
app->undo_items[2] = lookup_widget(app->window, "toolbutton_undo");
msgwin_init();
search_init();
}
......@@ -534,6 +531,8 @@ gint main(gint argc, gchar **argv)
#endif
if (no_msgwin) app->msgwindow_visible = FALSE;
msgwin_init();
search_init();
ui_create_insert_menu_items();
ui_create_insert_date_menu_items();
keybindings_init();
......@@ -568,12 +567,6 @@ gint main(gint argc, gchar **argv)
treeviews_prepare_openfiles();
treeviews_create_taglist_popup_menu();
treeviews_create_openfiles_popup_menu();
msgwin_prepare_status_tree_view();
msgwin_prepare_msg_tree_view();
msgwin_prepare_compiler_tree_view();
msgwindow.popup_status_menu = msgwin_create_message_popup_menu(MSG_STATUS);
msgwindow.popup_msg_menu = msgwin_create_message_popup_menu(MSG_MESSAGE);
msgwindow.popup_compiler_menu = msgwin_create_message_popup_menu(MSG_COMPILER);
#ifdef HAVE_VTE
vte_init();
#endif
......
......@@ -55,9 +55,14 @@ static const GdkColor white = {0, 65535, 65535, 65535};
MessageWindow msgwindow;
static void prepare_msg_tree_view(void);
static void prepare_status_tree_view(void);
static void prepare_compiler_tree_view(void);
static GtkWidget *create_message_popup_menu(gint type);
static void msgwin_parse_grep_line(const gchar *string, gchar **filename, gint *line);
static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton *event,
gpointer user_data);
static void on_scribble_populate(GtkTextView *textview, GtkMenu *arg1, gpointer user_data);
void msgwin_init()
......@@ -69,6 +74,16 @@ void msgwin_init()
msgwindow.find_in_files_dir = NULL;
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), FALSE);
prepare_status_tree_view();
prepare_msg_tree_view();
prepare_compiler_tree_view();
msgwindow.popup_status_menu = create_message_popup_menu(MSG_STATUS);
msgwindow.popup_msg_menu = create_message_popup_menu(MSG_MESSAGE);
msgwindow.popup_compiler_menu = create_message_popup_menu(MSG_COMPILER);
g_signal_connect(G_OBJECT(lookup_widget(app->window, "textview_scribble")),
"populate-popup", G_CALLBACK(on_scribble_populate), NULL);
}
......@@ -79,7 +94,7 @@ void msgwin_finalize()
/* does some preparing things to the status message list widget */
void msgwin_prepare_status_tree_view(void)
static void prepare_status_tree_view(void)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
......@@ -100,13 +115,12 @@ void msgwin_prepare_status_tree_view(void)
g_signal_connect(G_OBJECT(msgwindow.tree_status), "button-press-event",
G_CALLBACK(on_msgwin_button_press_event), GINT_TO_POINTER(MSG_STATUS));
}
/* does some preparing things to the message list widget
* (currently used for showing results of 'Find usage') */
void msgwin_prepare_msg_tree_view(void)
static void prepare_msg_tree_view(void)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
......@@ -138,7 +152,7 @@ void msgwin_prepare_msg_tree_view(void)
/* does some preparing things to the compiler list widget */
void msgwin_prepare_compiler_tree_view(void)
static void prepare_compiler_tree_view(void)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
......@@ -211,14 +225,15 @@ void msgwin_compiler_add(gint msg_color, const gchar *format, ...)
}
void msgwin_show()
void msgwin_show_hide(gboolean show)
{
app->msgwindow_visible = TRUE;
app->msgwindow_visible = show;
app->ignore_callback = TRUE;
gtk_check_menu_item_set_active(
GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_messages_window1")), TRUE);
GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_messages_window1")),
show);
app->ignore_callback = FALSE;
gtk_widget_show(lookup_widget(app->window, "scrolledwindow1"));
ui_widget_show_hide(lookup_widget(app->window, "scrolledwindow1"), show);
}
......@@ -228,7 +243,7 @@ void msgwin_msg_add(gint line, gint idx, const gchar *string)
GtkTreeIter iter;
static gint state = 0;
if (! app->msgwindow_visible) msgwin_show();
if (! app->msgwindow_visible) msgwin_show_hide(TRUE);
gtk_list_store_append(msgwindow.store_msg, &iter);
gtk_list_store_set(msgwindow.store_msg, &iter, 0, line, 1, idx, 2,
......@@ -346,7 +361,15 @@ on_compiler_treeview_copy_activate (GtkMenuItem *menuitem,
}
GtkWidget *msgwin_create_message_popup_menu(gint type)
static void
on_hide_message_window (GtkMenuItem *menuitem,
gpointer user_data)
{
msgwin_show_hide(FALSE);
}
static GtkWidget *create_message_popup_menu(gint type)
{
GtkWidget *message_popup_menu, *clear, *copy;
......@@ -355,20 +378,44 @@ GtkWidget *msgwin_create_message_popup_menu(gint type)
clear = gtk_image_menu_item_new_from_stock("gtk-clear", NULL);
gtk_widget_show(clear);
gtk_container_add(GTK_CONTAINER(message_popup_menu), clear);
g_signal_connect((gpointer)clear, "activate",
G_CALLBACK(on_message_treeview_clear_activate), GINT_TO_POINTER(type));
copy = gtk_image_menu_item_new_from_stock("gtk-copy", NULL);
gtk_widget_show(copy);
gtk_container_add(GTK_CONTAINER(message_popup_menu), copy);
g_signal_connect((gpointer)copy, "activate",
G_CALLBACK(on_compiler_treeview_copy_activate), GINT_TO_POINTER(type));
g_signal_connect((gpointer)clear, "activate",
G_CALLBACK(on_message_treeview_clear_activate), GINT_TO_POINTER(type));
msgwin_menu_add_common_items(GTK_MENU(message_popup_menu));
return message_popup_menu;
}
static void on_scribble_populate(GtkTextView *textview, GtkMenu *arg1, gpointer user_data)
{
msgwin_menu_add_common_items(arg1);
}
/* Menu items that should be on all message window popup menus */
void msgwin_menu_add_common_items(GtkMenu *menu)
{
GtkWidget *item;
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
item = gtk_menu_item_new_with_mnemonic(_("_Hide Message Window"));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
g_signal_connect((gpointer)item, "activate",
G_CALLBACK(on_hide_message_window), NULL);
}
gboolean msgwin_goto_compiler_file_line()
{
GtkTreeIter iter;
......
......@@ -66,13 +66,7 @@ void msgwin_init();
void msgwin_finalize();
void msgwin_prepare_msg_tree_view(void);
void msgwin_prepare_status_tree_view(void);
void msgwin_prepare_compiler_tree_view(void);
void msgwin_show();
void msgwin_show_hide(gboolean show);
void msgwin_msg_add(gint line, gint idx, const gchar *string);
......@@ -81,7 +75,7 @@ void msgwin_compiler_add(gint msg_color, const gchar *format, ...)
void msgwin_status_add(const gchar *format, ...) G_GNUC_PRINTF (1, 2);
GtkWidget *msgwin_create_message_popup_menu(gint type);
void msgwin_menu_add_common_items(GtkMenu *menu);
gboolean msgwin_goto_compiler_file_line();
......
......@@ -374,6 +374,8 @@ static GtkWidget *vte_create_popup_menu(void)
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
msgwin_menu_add_common_items(GTK_MENU(menu));
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), vc->im_submenu);
return menu;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment