anjuta r4415 - in trunk: . plugins/devhelp plugins/message-view
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4415 - in trunk: . plugins/devhelp plugins/message-view
- Date: Sun, 30 Nov 2008 18:52:33 +0000 (UTC)
Author: jhs
Date: Sun Nov 30 18:52:33 2008
New Revision: 4415
URL: http://svn.gnome.org/viewvc/anjuta?rev=4415&view=rev
Log:
2008-11-30 Johannes Schmid <jhs gnome org>
Patch from: Ignacio Casal Quinteiro <nacho resa gmail com>
* plugins/devhelp/plugin.c (devhelp_tree_link_selected_cb),
(devhelp_search_link_selected_cb), (on_go_back_clicked),
(on_go_forward_clicked), (api_reference_idle), (devhelp_activate),
(devhelp_deactivate), (ihelp_search):
* plugins/devhelp/plugin.h:
#562750 â The view should be showed when you search something.
* plugins/message-view/message-view.c (message_view_instance_init),
(update_button_labels), (imessage_view_append),
(imessage_view_clear), (message_view_tree_view_filter):
Add a button to suppress normal message (show errors & warnings only)
Use fixed height mode to optimize performance
Modified:
trunk/ChangeLog
trunk/plugins/devhelp/plugin.c
trunk/plugins/devhelp/plugin.h
trunk/plugins/message-view/message-view.c
Modified: trunk/plugins/devhelp/plugin.c
==============================================================================
--- trunk/plugins/devhelp/plugin.c (original)
+++ trunk/plugins/devhelp/plugin.c Sun Nov 30 18:52:33 2008
@@ -77,8 +77,8 @@
{
gchar *uri;
- /*anjuta_shell_present_widget (ANJUTA_PLUGIN (widget)->shell,
- widget->view, NULL);*/
+ anjuta_shell_present_widget (ANJUTA_PLUGIN (widget)->shell,
+ widget->view_sw, NULL);
uri = dh_link_get_uri (link);
webkit_web_view_open (WEBKIT_WEB_VIEW (widget->view), uri);
@@ -93,8 +93,8 @@
{
gchar *uri;
- /*anjuta_shell_present_widget (ANJUTA_PLUGIN (widget)->shell,
- widget->view, NULL);*/
+ anjuta_shell_present_widget (ANJUTA_PLUGIN (widget)->shell,
+ widget->view_sw, NULL);
uri = dh_link_get_uri (link);
webkit_web_view_open (WEBKIT_WEB_VIEW (widget->view), uri);
@@ -106,6 +106,9 @@
static void
on_go_back_clicked (GtkWidget *widget, AnjutaDevhelp *plugin)
{
+ anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
+ plugin->view_sw, NULL);
+
webkit_web_view_go_back (WEBKIT_WEB_VIEW (plugin->view));
anjuta_devhelp_check_history (plugin);
@@ -114,6 +117,9 @@
static void
on_go_forward_clicked (GtkWidget *widget, AnjutaDevhelp *plugin)
{
+ anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
+ plugin->view_sw, NULL);
+
webkit_web_view_go_forward (WEBKIT_WEB_VIEW (plugin->view));
anjuta_devhelp_check_history (plugin);
@@ -124,7 +130,7 @@
{
gtk_notebook_set_current_page (GTK_NOTEBOOK (plugin->control_notebook), 0);
anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
- plugin->control_notebook, NULL);
+ plugin->main_vbox, NULL);
return FALSE;
}
@@ -279,8 +285,6 @@
GNode *books;
GList *keywords;
GtkWidget* books_sw;
- GtkWidget *scrolled_window;
- GtkWidget *main_vbox;
GtkWidget *button_hbox;
if (!init)
@@ -308,8 +312,8 @@
/*
* Forward/back buttons
*/
- main_vbox = gtk_vbox_new (FALSE, 6);
- gtk_widget_show (main_vbox);
+ devhelp->main_vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (devhelp->main_vbox);
button_hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (button_hbox);
@@ -327,7 +331,7 @@
g_signal_connect (devhelp->go_forward, "clicked",
G_CALLBACK (on_go_forward_clicked), devhelp);
- gtk_box_pack_start (GTK_BOX (main_vbox), button_hbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (devhelp->main_vbox), button_hbox, FALSE, FALSE, 0);
/*
* Notebook
@@ -344,7 +348,8 @@
gtk_container_set_border_width (GTK_CONTAINER (books_sw), 2);
devhelp->control_notebook = gtk_notebook_new ();
- gtk_box_pack_start (GTK_BOX (main_vbox), devhelp->control_notebook, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (devhelp->main_vbox), devhelp->control_notebook,
+ TRUE, TRUE, 0);
devhelp->book_tree = dh_book_tree_new (books);
devhelp->search = dh_search_new (keywords);
@@ -373,18 +378,18 @@
webkit_web_view_open (WEBKIT_WEB_VIEW (devhelp->view), "about:blank");
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+ devhelp->view_sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (devhelp->view_sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- gtk_widget_show (scrolled_window);
- gtk_container_add (GTK_CONTAINER (scrolled_window), devhelp->view);
+ gtk_widget_show (devhelp->view_sw);
+ gtk_container_add (GTK_CONTAINER (devhelp->view_sw), devhelp->view);
- anjuta_shell_add_widget (plugin->shell, main_vbox,
+ anjuta_shell_add_widget (plugin->shell, devhelp->main_vbox,
"AnjutaDevhelpIndex", _("Help"), ANJUTA_STOCK_DEVHELP,
ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
/* This is the window that show the html help text */
- anjuta_shell_add_widget (plugin->shell, scrolled_window,
+ anjuta_shell_add_widget (plugin->shell, devhelp->view_sw,
"AnjutaDevhelpDisplay", _("Help display"),
ANJUTA_STOCK_DEVHELP,
ANJUTA_SHELL_PLACEMENT_CENTER, NULL);
@@ -416,8 +421,8 @@
#ifndef DISABLE_EMBEDDED_DEVHELP
/* Remove widgets */
- anjuta_shell_remove_widget(plugin->shell, devhelp->view, NULL);
- anjuta_shell_remove_widget(plugin->shell, devhelp->control_notebook, NULL);
+ anjuta_shell_remove_widget(plugin->shell, devhelp->view_sw, NULL);
+ anjuta_shell_remove_widget(plugin->shell, devhelp->main_vbox, NULL);
#endif /* DISABLE_EMBEDDED_DEVHELP */
@@ -509,7 +514,7 @@
plugin = ANJUTA_PLUGIN_DEVHELP (help);
anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
- plugin->control_notebook, NULL);
+ plugin->main_vbox, NULL);
dh_search_set_search_string (DH_SEARCH (plugin->search), query, NULL);
gtk_notebook_set_current_page (GTK_NOTEBOOK (plugin->control_notebook), 1);
Modified: trunk/plugins/devhelp/plugin.h
==============================================================================
--- trunk/plugins/devhelp/plugin.h (original)
+++ trunk/plugins/devhelp/plugin.h Sun Nov 30 18:52:33 2008
@@ -49,8 +49,10 @@
#ifndef DISABLE_EMBEDDED_DEVHELP
DhBase *base;
#endif /* DISABLE_EMBEDDED_DEVHELP */
- GtkWidget *view;
+ GtkWidget *view;
+ GtkWidget *view_sw;
GtkWidget *control_notebook;
+ GtkWidget *main_vbox;
GtkWidget *book_tree;
GtkWidget *search;
GtkWidget *go_back;
Modified: trunk/plugins/message-view/message-view.c
==============================================================================
--- trunk/plugins/message-view/message-view.c (original)
+++ trunk/plugins/message-view/message-view.c Sun Nov 30 18:52:33 2008
@@ -41,8 +41,8 @@
gint adj_chgd_hdlr;
/* Messages filter buttons */
- GtkWidget *info, *warn, *error;
- guint info_count, warn_count, error_count;
+ GtkWidget *normal, *info, *warn, *error;
+ guint normal_count, info_count, warn_count, error_count;
/* Properties */
gchar *label;
@@ -714,12 +714,14 @@
GtkTreeSelection *select;
GtkListStore *model;
GtkAdjustment* adj;
-
+ gint icon_width = 30; // FIXME: Obtain from theme
+
g_return_if_fail(self != NULL);
self->privat = g_new0 (MessageViewPrivate, 1);
/* Init private data */
self->privat->line_buffer = g_strdup("");
+ self->privat->normal_count = 0;
self->privat->info_count = 0;
self->privat->warn_count = 0;
self->privat->error_count = 0;
@@ -728,7 +730,15 @@
vbox = gtk_hbox_new (FALSE, 0);
filter_buttons_box = gtk_vbox_new (FALSE, 1);
- self->privat->info = gtk_toggle_button_new_with_label (_("0 Messages"));
+ self->privat->normal = gtk_toggle_button_new_with_label (_("No Messages"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->privat->normal), TRUE);
+ gtk_button_set_focus_on_click (GTK_BUTTON (self->privat->normal), FALSE);
+ gtk_button_set_relief (GTK_BUTTON (self->privat->normal), GTK_RELIEF_HALF);
+ gtk_widget_show (self->privat->normal);
+ g_signal_connect (G_OBJECT (self->privat->normal), "toggled",
+ G_CALLBACK (on_filter_buttons_toggled), self);
+
+ self->privat->info = gtk_toggle_button_new_with_label (_("No Infos"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->privat->info), TRUE);
gtk_button_set_focus_on_click (GTK_BUTTON (self->privat->info), FALSE);
gtk_button_set_relief (GTK_BUTTON (self->privat->info), GTK_RELIEF_HALF);
@@ -739,7 +749,7 @@
g_signal_connect (G_OBJECT (self->privat->info), "toggled",
G_CALLBACK (on_filter_buttons_toggled), self);
- self->privat->warn = gtk_toggle_button_new_with_label (_("0 Warnings"));
+ self->privat->warn = gtk_toggle_button_new_with_label (_("No Warnings"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->privat->warn), TRUE);
gtk_button_set_focus_on_click (GTK_BUTTON (self->privat->warn), FALSE);
gtk_button_set_relief (GTK_BUTTON (self->privat->warn), GTK_RELIEF_HALF);
@@ -751,7 +761,7 @@
g_signal_connect (G_OBJECT (self->privat->warn), "toggled",
G_CALLBACK (on_filter_buttons_toggled), self);
- self->privat->error = gtk_toggle_button_new_with_label (_("0 Errors"));
+ self->privat->error = gtk_toggle_button_new_with_label (_("No Errors"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->privat->error), TRUE);
gtk_button_set_focus_on_click (GTK_BUTTON (self->privat->error), FALSE);
gtk_button_set_relief (GTK_BUTTON (self->privat->error), GTK_RELIEF_HALF);
@@ -762,6 +772,8 @@
g_signal_connect (G_OBJECT (self->privat->error), "toggled",
G_CALLBACK (on_filter_buttons_toggled), self);
+ gtk_box_pack_start (GTK_BOX (filter_buttons_box), GTK_WIDGET (self->privat->normal),
+ FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (filter_buttons_box), GTK_WIDGET (self->privat->info),
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (filter_buttons_box), GTK_WIDGET (self->privat->warn),
@@ -791,11 +803,16 @@
/* Create pixbuf column */
renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
+ g_object_set (G_OBJECT(renderer_pixbuf), "stock-size", GTK_ICON_SIZE_MENU, NULL);
column_pixbuf = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column_pixbuf, _("Icon"));
gtk_tree_view_column_pack_start (column_pixbuf, renderer_pixbuf, TRUE);
gtk_tree_view_column_add_attribute
(column_pixbuf, renderer_pixbuf, "stock-id", COLUMN_PIXBUF);
+ gtk_tree_view_column_set_sizing(column_pixbuf, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column_pixbuf, icon_width);
+ gtk_tree_view_column_set_min_width (column_pixbuf, icon_width);
+ gtk_tree_view_column_set_max_width (column_pixbuf, icon_width);
gtk_tree_view_append_column (GTK_TREE_VIEW (self->privat->tree_view),
column_pixbuf);
/* Create columns to hold text and color of a line, this
@@ -803,8 +820,11 @@
renderer = gtk_cell_renderer_text_new ();
g_object_set (renderer, "yalign", 0.0, "wrap-mode", PANGO_WRAP_WORD,
"wrap-width", 1000, NULL);
+ gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(renderer), 1);
column = gtk_tree_view_column_new ();
+
gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_title (column, _("Messages"));
gtk_tree_view_column_add_attribute
(column, renderer, "foreground", COLUMN_COLOR);
@@ -817,6 +837,9 @@
select = gtk_tree_view_get_selection
(GTK_TREE_VIEW (self->privat->tree_view));
gtk_tree_selection_set_mode (select, GTK_SELECTION_BROWSE);
+
+ /* Optimize */
+ gtk_tree_view_set_fixed_height_mode(GTK_TREE_VIEW(self->privat->tree_view), TRUE);
/* Add tree view to a scrolled window */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
@@ -1292,6 +1315,12 @@
gchar* temp;
temp = g_strdup_printf(ngettext ("%d Message", "%d Messages",
+ view->privat->normal_count),
+ view->privat->normal_count);
+ gtk_button_set_label (GTK_BUTTON (view->privat->normal), temp);
+ g_free(temp);
+
+ temp = g_strdup_printf(ngettext ("%d Info", "%d Infos",
view->privat->info_count),
view->privat->info_count);
gtk_button_set_label (GTK_BUTTON (view->privat->info), temp);
@@ -1359,6 +1388,7 @@
break;
default:
color = NULL;
+ view->privat->normal_count++;
}
}
update_button_labels (view);
@@ -1413,9 +1443,11 @@
view = MESSAGE_VIEW (message_view);
/* filter settings restart */
+ view->privat->normal_count = 0;
view->privat->info_count = 0;
view->privat->warn_count = 0;
view->privat->error_count = 0;
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->privat->normal), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->privat->info), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->privat->warn), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->privat->error), TRUE);
@@ -1549,7 +1581,9 @@
gtk_tree_model_get (msgview->privat->model, iter, COLUMN_MESSAGE, &msg, -1);
if (msg != NULL) {
- if (msg->type == IANJUTA_MESSAGE_VIEW_TYPE_INFO) {
+ if (msg->type == IANJUTA_MESSAGE_VIEW_TYPE_NORMAL) {
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (msgview->privat->normal));
+ } else if (msg->type == IANJUTA_MESSAGE_VIEW_TYPE_INFO) {
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (msgview->privat->info));
} else if (msg->type == IANJUTA_MESSAGE_VIEW_TYPE_WARNING) {
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (msgview->privat->warn));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]