Revision: 4499 http://geany.svn.sourceforge.net/geany/?rev=4499&view=rev Author: eht16 Date: 2009-12-20 20:07:04 +0000 (Sun, 20 Dec 2009)
Log Message: ----------- Add MessageWindow::scribble and use it instead of searching the widget pointer everytime.
Modified Paths: -------------- trunk/ChangeLog trunk/src/keybindings.c trunk/src/keyfile.c trunk/src/main.c trunk/src/msgwindow.c trunk/src/msgwindow.h trunk/src/prefs.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-12-20 15:50:53 UTC (rev 4498) +++ trunk/ChangeLog 2009-12-20 20:07:04 UTC (rev 4499) @@ -12,6 +12,10 @@ * src/document.c: When closing a document after it was deleted from the filesystem, don't ask whether it should be saved first. + * src/keybindings.c, src/keyfile.c, src/main.c, src/msgwindow.c, + src/msgwindow.h, src/prefs.c: + Add MessageWindow::scribble and use it instead of searching the + widget pointer everytime.
2009-12-20 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2009-12-20 15:50:53 UTC (rev 4498) +++ trunk/src/keybindings.c 2009-12-20 20:07:04 UTC (rev 4499) @@ -1003,11 +1003,6 @@ if ((keyval == GDK_Menu && state == 0) || (keyval == GDK_F10 && state == GDK_SHIFT_MASK)) { GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); - static GtkWidget *scribble = NULL; - - if (scribble == NULL) - scribble = ui_lookup_widget(main_widgets.window, "textview_scribble"); - if (doc != NULL) { if (focusw == doc->priv->tag_tree) @@ -1033,7 +1028,7 @@ || focusw == msgwindow.tree_status || focusw == msgwindow.tree_compiler || focusw == msgwindow.tree_msg - || focusw == scribble + || focusw == msgwindow.scribble #ifdef HAVE_VTE || (vte_info.have_vte && focusw == vc->vte) #endif @@ -2399,14 +2394,11 @@ GeanyDocument *doc; ScintillaObject *sci; GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); - static GtkWidget *scribble_widget = NULL;
/* special case for Select All in the scribble widget */ - if (scribble_widget == NULL) /* lookup the scribble widget only once */ - scribble_widget = ui_lookup_widget(main_widgets.window, "textview_scribble"); - if (key_id == GEANY_KEYS_SELECT_ALL && focusw == scribble_widget) + if (key_id == GEANY_KEYS_SELECT_ALL && focusw == msgwindow.scribble) { - g_signal_emit_by_name(scribble_widget, "select-all", TRUE); + g_signal_emit_by_name(msgwindow.scribble, "select-all", TRUE); return TRUE; }
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2009-12-20 15:50:53 UTC (rev 4498) +++ trunk/src/keyfile.c 2009-12-20 20:07:04 UTC (rev 4499) @@ -476,7 +476,7 @@ GtkTextIter start, end, iter; GtkTextMark *mark;
- buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui_lookup_widget(main_widgets.window, "textview_scribble"))); + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(msgwindow.scribble)); gtk_text_buffer_get_bounds(buffer, &start, &end); scribble_text = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); g_key_file_set_string(config, PACKAGE, "scribble_text", scribble_text); @@ -1051,8 +1051,7 @@ { /* update the scribble widget, because now it's realized */ GtkTextIter iter; GtkTextBuffer *buffer = - gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui_lookup_widget(main_widgets.window, - "textview_scribble"))); + gtk_text_view_get_buffer(GTK_TEXT_VIEW(msgwindow.scribble));
gtk_text_buffer_set_text(buffer, scribble_text, -1); gtk_text_buffer_get_iter_at_offset(buffer, &iter, scribble_pos);
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2009-12-20 15:50:53 UTC (rev 4498) +++ trunk/src/main.c 2009-12-20 20:07:04 UTC (rev 4499) @@ -1001,8 +1001,7 @@ g_signal_connect(main_widgets.window, "delete-event", G_CALLBACK(on_exit_clicked), NULL); g_signal_connect(main_widgets.window, "window-state-event", G_CALLBACK(on_window_state_event), NULL);
- g_signal_connect(ui_lookup_widget(main_widgets.window, "textview_scribble"), - "motion-notify-event", G_CALLBACK(on_motion_event), NULL); + g_signal_connect(msgwindow.scribble, "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
#ifdef HAVE_VTE vte_init();
Modified: trunk/src/msgwindow.c =================================================================== --- trunk/src/msgwindow.c 2009-12-20 15:50:53 UTC (rev 4498) +++ trunk/src/msgwindow.c 2009-12-20 20:07:04 UTC (rev 4499) @@ -75,12 +75,13 @@ static void on_scribble_populate(GtkTextView *textview, GtkMenu *arg1, gpointer user_data);
-void msgwin_init() +void msgwin_init(void) { msgwindow.notebook = ui_lookup_widget(main_widgets.window, "notebook_info"); msgwindow.tree_status = ui_lookup_widget(main_widgets.window, "treeview3"); msgwindow.tree_msg = ui_lookup_widget(main_widgets.window, "treeview4"); msgwindow.tree_compiler = ui_lookup_widget(main_widgets.window, "treeview5"); + msgwindow.scribble = ui_lookup_widget(main_widgets.window, "textview_scribble"); msgwindow.find_in_files_dir = NULL;
prepare_status_tree_view(); @@ -90,15 +91,12 @@ msgwindow.popup_msg_menu = create_message_popup_menu(MSG_MESSAGE); msgwindow.popup_compiler_menu = create_message_popup_menu(MSG_COMPILER);
- ui_widget_modify_font_from_string( - ui_lookup_widget(main_widgets.window, "textview_scribble"), interface_prefs.msgwin_font); - - g_signal_connect(ui_lookup_widget(main_widgets.window, "textview_scribble"), - "populate-popup", G_CALLBACK(on_scribble_populate), NULL); + ui_widget_modify_font_from_string(msgwindow.scribble, interface_prefs.msgwin_font); + g_signal_connect(msgwindow.scribble, "populate-popup", G_CALLBACK(on_scribble_populate), NULL); }
-void msgwin_finalize() +void msgwin_finalize(void) { g_free(msgwindow.find_in_files_dir); } @@ -629,7 +627,7 @@ }
-gboolean msgwin_goto_compiler_file_line() +gboolean msgwin_goto_compiler_file_line(void) { GtkTreeIter iter; GtkTreeModel *model; @@ -942,7 +940,7 @@ }
-gboolean msgwin_goto_messages_file_line() +gboolean msgwin_goto_messages_file_line(void) { GtkTreeIter iter; GtkTreeModel *model; @@ -1075,7 +1073,7 @@
switch (tabnum) { - case MSG_SCRATCH: widget = ui_lookup_widget(main_widgets.window, "textview_scribble"); break; + case MSG_SCRATCH: widget = msgwindow.scribble; break; case MSG_COMPILER: widget = msgwindow.tree_compiler; break; case MSG_STATUS: widget = msgwindow.tree_status; break; case MSG_MESSAGE: widget = msgwindow.tree_msg; break;
Modified: trunk/src/msgwindow.h =================================================================== --- trunk/src/msgwindow.h 2009-12-20 15:50:53 UTC (rev 4498) +++ trunk/src/msgwindow.h 2009-12-20 20:07:04 UTC (rev 4499) @@ -64,6 +64,7 @@ GtkWidget *tree_compiler; GtkWidget *tree_status; GtkWidget *tree_msg; + GtkWidget *scribble; GtkWidget *popup_status_menu; GtkWidget *popup_msg_menu; GtkWidget *popup_compiler_menu;
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2009-12-20 15:50:53 UTC (rev 4498) +++ trunk/src/prefs.c 2009-12-20 20:07:04 UTC (rev 4499) @@ -1192,9 +1192,7 @@ ui_widget_modify_font_from_string(msgwindow.tree_compiler, interface_prefs.msgwin_font); ui_widget_modify_font_from_string(msgwindow.tree_msg, interface_prefs.msgwin_font); ui_widget_modify_font_from_string(msgwindow.tree_status, interface_prefs.msgwin_font); - ui_widget_modify_font_from_string( - ui_lookup_widget(main_widgets.window, "textview_scribble"), - interface_prefs.msgwin_font); + ui_widget_modify_font_from_string(msgwindow.scribble, interface_prefs.msgwin_font); break; } case 3:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.