1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) 2003 Naba Kumar <naba@gnome.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc., 59
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
35 #include <gtksourceview/gtksourceview.h>
37 #include <libanjuta/anjuta-shell.h>
38 #include <libanjuta/anjuta-ui.h>
39 #include <libanjuta/anjuta-utils.h>
40 #include <libanjuta/resources.h>
41 #include <libanjuta/anjuta-plugin-manager.h>
42 #include <libanjuta/anjuta-debug.h>
44 #include "anjuta-window.h"
45 #include "anjuta-actions.h"
46 #include "anjuta-application.h"
49 #define UI_FILE PACKAGE_DATA_DIR"/ui/anjuta.xml"
50 #define GLADE_FILE PACKAGE_DATA_DIR"/glade/preferences.ui"
51 #define ICON_FILE "anjuta-preferences-general-48.png"
53 #define PREF_SCHEMA "org.gnome.anjuta"
54 #define GDL_STYLE "gdl-style"
55 #define TOOLBAR_VISIBLE "toolbar-visible"
56 #define TOOLBAR_STYLE "toolbar-style"
58 #define WIDTH_MARGIN 48
59 #define HEIGHT_MARGIN 24
60 #define DEFAULT_WIDTH (1024 - WIDTH_MARGIN)
61 #define DEFAULT_HEIGHT (768 - HEIGHT_MARGIN)
63 static void anjuta_window_layout_load (AnjutaWindow
*win
,
64 const gchar
*layout_filename
,
66 static void anjuta_window_layout_save (AnjutaWindow
*win
,
67 const gchar
*layout_filename
,
70 static gpointer parent_class
= NULL
;
71 static GtkToolbarStyle style
= -1;
74 menu_item_select_cb (GtkMenuItem
*proxy
,
80 action
= gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy
));
81 g_return_if_fail (action
!= NULL
);
83 g_object_get (G_OBJECT (action
), "tooltip", &message
, NULL
);
86 anjuta_status_push (win
->status
, "%s", message
);
92 menu_item_deselect_cb (GtkMenuItem
*proxy
,
95 anjuta_status_pop (win
->status
);
100 connect_proxy_cb (GtkUIManager
*manager
,
105 if (GTK_IS_MENU_ITEM (proxy
))
107 g_signal_connect (proxy
, "select",
108 G_CALLBACK (menu_item_select_cb
), win
);
109 g_signal_connect (proxy
, "deselect",
110 G_CALLBACK (menu_item_deselect_cb
), win
);
115 disconnect_proxy_cb (GtkUIManager
*manager
,
120 if (GTK_IS_MENU_ITEM (proxy
))
122 g_signal_handlers_disconnect_by_func
123 (proxy
, G_CALLBACK (menu_item_select_cb
), win
);
124 g_signal_handlers_disconnect_by_func
125 (proxy
, G_CALLBACK (menu_item_deselect_cb
), win
);
130 anjuta_window_iconify_dockable_widget (AnjutaShell
*shell
, GtkWidget
*widget
,
133 AnjutaWindow
*win
= NULL
;
134 GtkWidget
*dock_item
= NULL
;
136 /* Argumments assertions */
137 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
138 g_return_if_fail (GTK_IS_WIDGET (widget
));
140 win
= ANJUTA_WINDOW (shell
);
141 g_return_if_fail (win
->widgets
!= NULL
);
143 dock_item
= g_object_get_data (G_OBJECT (widget
), "dockitem");
144 g_return_if_fail (dock_item
!= NULL
);
146 /* Iconify the dockable item */
147 gdl_dock_item_iconify_item (GDL_DOCK_ITEM (dock_item
));
151 anjuta_window_hide_dockable_widget (AnjutaShell
*shell
, GtkWidget
*widget
,
154 AnjutaWindow
*win
= NULL
;
155 GtkWidget
*dock_item
= NULL
;
157 /* Argumments assertions */
158 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
159 g_return_if_fail (GTK_IS_WIDGET (widget
));
161 win
= ANJUTA_WINDOW (shell
);
162 g_return_if_fail (win
->widgets
!= NULL
);
164 dock_item
= g_object_get_data (G_OBJECT (widget
), "dockitem");
165 g_return_if_fail (dock_item
!= NULL
);
167 /* Hide the dockable item */
168 gdl_dock_item_hide_item (GDL_DOCK_ITEM (dock_item
));
172 anjuta_window_show_dockable_widget (AnjutaShell
*shell
, GtkWidget
* widget
,
175 AnjutaWindow
*win
= NULL
;
176 GtkWidget
*dock_item
= NULL
;
178 /* Argumments assertions */
179 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
180 g_return_if_fail (GTK_IS_WIDGET (widget
));
182 win
= ANJUTA_WINDOW (shell
);
183 g_return_if_fail (win
->widgets
!= NULL
);
185 dock_item
= g_object_get_data (G_OBJECT (widget
), "dockitem");
186 g_return_if_fail (dock_item
!= NULL
);
188 /* Show the dockable item */
189 gdl_dock_item_show_item(GDL_DOCK_ITEM (dock_item
));
193 anjuta_window_maximize_widget (AnjutaShell
*shell
,
194 const char *widget_name
,
197 AnjutaWindow
*win
= NULL
;
198 GtkWidget
*dock_item
= NULL
;
200 GtkWidget
*widget
= NULL
;
203 /* AnjutaWindow assertions */
204 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
205 win
= ANJUTA_WINDOW (shell
);
207 /* If win->maximized is TRUE then another widget is already maximized.
208 Restoring the UI for a new maximization. */
210 gdl_dock_layout_load_layout (win
->layout_manager
, "back-up");
212 /* Back-up the layout so it can be restored */
213 gdl_dock_layout_save_layout(win
->layout_manager
, "back-up");
215 /* Mark the win as maximized (the other widgets except center are hidden) */
216 win
->maximized
= TRUE
;
218 /* Hide all DockItem's except the ones positioned in the center */
219 g_hash_table_iter_init (&iter
, win
->widgets
);
220 while (g_hash_table_iter_next (&iter
, &key
, &value
))
225 /* Widget assertions */
226 widget
= GTK_WIDGET (value
);
227 if(!GTK_IS_WIDGET (widget
))
230 /* DockItem assertions */
231 dock_item
= g_object_get_data (G_OBJECT (widget
), "dockitem");
232 if(dock_item
== NULL
|| !GDL_IS_DOCK_ITEM (dock_item
))
235 if(!g_strcmp0((gchar
*)key
, widget_name
))
237 /* If it's the widget requesting maximization then make sure the
238 * widget is visible*/
239 gdl_dock_item_show_item (GDL_DOCK_ITEM (dock_item
));
243 /* Hide the other item */
244 gdl_dock_item_hide_item (GDL_DOCK_ITEM (dock_item
));
250 anjuta_window_unmaximize (AnjutaShell
*shell
,
253 AnjutaWindow
*win
= NULL
;
255 /* AnjutaWindow assertions */
256 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
257 win
= ANJUTA_WINDOW (shell
);
259 /* If not maximized then the operation doesn't make sence. */
260 g_return_if_fail (win
->maximized
);
262 /* Load the backed-up layout */
263 gdl_dock_layout_load_layout (win
->layout_manager
, "back-up");
264 gdl_dock_layout_delete_layout (win
->layout_manager
, "back-up");
266 /* Un-mark maximized */
267 win
->maximized
= FALSE
;
271 anjuta_window_create_window (AnjutaShell
*shell
,
274 AnjutaWindow
*win
= NULL
;
275 AnjutaApplication
*app
;
277 /* AnjutaWindow assertions */
278 g_return_val_if_fail (ANJUTA_IS_WINDOW (shell
), NULL
);
280 app
= ANJUTA_APPLICATION (gtk_window_get_application (GTK_WINDOW (shell
)));
281 win
= anjuta_application_create_window (ANJUTA_APPLICATION (app
));
283 return ANJUTA_SHELL (win
);
287 on_toolbar_style_changed (GSettings
* settings
,
291 AnjutaWindow
* win
= ANJUTA_WINDOW (user_data
);
292 gchar
* tb_style
= g_settings_get_string (settings
, key
);
294 if (strcasecmp (tb_style
, "Default") == 0)
296 else if (strcasecmp (tb_style
, "Both") == 0)
297 style
= GTK_TOOLBAR_BOTH
;
298 else if (strcasecmp (tb_style
, "Horiz") == 0)
299 style
= GTK_TOOLBAR_BOTH_HORIZ
;
300 else if (strcasecmp (tb_style
, "Icons") == 0)
301 style
= GTK_TOOLBAR_ICONS
;
302 else if (strcasecmp (tb_style
, "Text") == 0)
303 style
= GTK_TOOLBAR_TEXT
;
307 gtk_toolbar_set_style (GTK_TOOLBAR (win
->toolbar
), style
);
311 gtk_toolbar_unset_style (GTK_TOOLBAR (win
->toolbar
));
317 on_gdl_style_changed (GSettings
* settings
,
321 AnjutaWindow
* win
= ANJUTA_WINDOW (user_data
);
322 GdlSwitcherStyle style
= GDL_SWITCHER_STYLE_BOTH
;
324 gchar
* pr_style
= g_settings_get_string (settings
, key
);
326 if (strcasecmp (pr_style
, "Text") == 0)
327 style
= GDL_SWITCHER_STYLE_TEXT
;
328 else if (strcasecmp (pr_style
, "Icon") == 0)
329 style
= GDL_SWITCHER_STYLE_ICON
;
330 else if (strcasecmp (pr_style
, "Both") == 0)
331 style
= GDL_SWITCHER_STYLE_BOTH
;
332 else if (strcasecmp (pr_style
, "Toolbar") == 0)
333 style
= GDL_SWITCHER_STYLE_TOOLBAR
;
334 else if (strcasecmp (pr_style
, "Tabs") == 0)
335 style
= GDL_SWITCHER_STYLE_TABS
;
337 g_object_set (gdl_dock_layout_get_master (win
->layout_manager
), "switcher-style",
343 on_toggle_widget_view (GtkCheckMenuItem
*menuitem
, GtkWidget
*dockitem
)
346 state
= gtk_check_menu_item_get_active (menuitem
);
348 gdl_dock_item_show_item (GDL_DOCK_ITEM (dockitem
));
350 gdl_dock_item_hide_item (GDL_DOCK_ITEM (dockitem
));
354 on_update_widget_view_menuitem (gpointer key
, gpointer wid
, gpointer data
)
356 GtkCheckMenuItem
*menuitem
;
357 GdlDockItem
*dockitem
;
359 dockitem
= g_object_get_data (G_OBJECT (wid
), "dockitem");
360 menuitem
= g_object_get_data (G_OBJECT (wid
), "menuitem");
362 g_signal_handlers_block_by_func (menuitem
,
363 G_CALLBACK (on_toggle_widget_view
),
366 if (GDL_DOCK_OBJECT_ATTACHED (dockitem
))
367 gtk_check_menu_item_set_active (menuitem
, TRUE
);
369 gtk_check_menu_item_set_active (menuitem
, FALSE
);
371 g_signal_handlers_unblock_by_func (menuitem
,
372 G_CALLBACK (on_toggle_widget_view
),
377 on_layout_dirty_notify (GObject
*object
, GParamSpec
*pspec
, gpointer user_data
)
379 if (!strcmp (pspec
->name
, "dirty")) {
381 g_object_get (object
, "dirty", &dirty
, NULL
);
383 /* Update UI toggle buttons */
384 g_hash_table_foreach (ANJUTA_WINDOW (user_data
)->widgets
,
385 on_update_widget_view_menuitem
,
392 on_layout_locked_notify (GdlDockMaster
*master
, GParamSpec
*pspec
,
400 action
= anjuta_ui_get_action (ui
, "ActionGroupToggleView",
401 "ActionViewLockLayout");
403 g_object_get (master
, "locked", &locked
, NULL
);
404 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action
),
409 on_session_save (AnjutaShell
*shell
, AnjutaSessionPhase phase
,
410 AnjutaSession
*session
, AnjutaWindow
*win
)
412 gchar
*geometry
, *layout_file
;
413 GdkWindowState state
;
415 if (phase
!= ANJUTA_SESSION_PHASE_NORMAL
)
419 state
= gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (win
)));
420 if (state
& GDK_WINDOW_STATE_MAXIMIZED
) {
421 anjuta_session_set_int (session
, "Anjuta", "Maximized", 1);
423 if (state
& GDK_WINDOW_STATE_FULLSCREEN
) {
424 anjuta_session_set_int (session
, "Anjuta", "Fullscreen", 1);
427 /* Save geometry only if window is not maximized or fullscreened */
428 if (!(state
& GDK_WINDOW_STATE_MAXIMIZED
) ||
429 !(state
& GDK_WINDOW_STATE_FULLSCREEN
))
431 geometry
= anjuta_window_get_geometry (win
);
433 anjuta_session_set_string (session
, "Anjuta", "Geometry",
439 layout_file
= g_build_filename (anjuta_session_get_session_directory (session
),
440 "dock-layout.xml", NULL
);
441 anjuta_window_layout_save (win
, layout_file
, NULL
);
442 g_free (layout_file
);
446 on_session_load (AnjutaShell
*shell
, AnjutaSessionPhase phase
,
447 AnjutaSession
*session
, AnjutaWindow
*win
)
449 if (phase
== ANJUTA_SESSION_PHASE_START
)
451 AnjutaApplication
*app
;
453 app
= ANJUTA_APPLICATION (gtk_window_get_application (GTK_WINDOW (win
)));
456 if (anjuta_application_get_no_session (app
))
459 anjuta_session_clear (session
);
461 else if (anjuta_application_get_no_files (app
))
463 /* Clear files from session */
464 anjuta_session_set_string_list (session
, "File Loader",
467 if (anjuta_application_get_geometry (app
))
469 /* Set new geometry */
470 anjuta_session_set_string (session
, "Anjuta", "Geometry",
471 anjuta_application_get_geometry (app
));
476 /* We load layout at last so that all plugins would have loaded by now */
477 if (phase
== ANJUTA_SESSION_PHASE_LAST
)
482 /* Restore geometry */
483 geometry
= anjuta_session_get_string (session
, "Anjuta", "Geometry");
484 anjuta_window_set_geometry (win
, geometry
);
487 /* Restore window state */
488 if (anjuta_session_get_int (session
, "Anjuta", "Fullscreen"))
491 AnjutaUI
* ui
= anjuta_shell_get_ui(shell
, NULL
);
492 GtkAction
* action
= anjuta_ui_get_action (ui
, "ActionGroupToggleView",
493 "ActionViewFullscreen");
494 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action
),
497 gtk_window_fullscreen (GTK_WINDOW (shell
));
500 else if (anjuta_session_get_int (session
, "Anjuta", "Maximized"))
502 gtk_window_maximize (GTK_WINDOW (shell
));
506 gtk_window_unmaximize (GTK_WINDOW (shell
));
508 gtk_widget_show (GTK_WIDGET (win
));
511 layout_file
= g_build_filename (anjuta_session_get_session_directory (session
),
512 "dock-layout.xml", NULL
);
513 anjuta_window_layout_load (win
, layout_file
, NULL
);
514 g_free (layout_file
);
519 anjuta_window_dispose (GObject
*widget
)
523 g_return_if_fail (ANJUTA_IS_WINDOW (widget
));
525 win
= ANJUTA_WINDOW (widget
);
529 if (g_hash_table_size (win
->widgets
) > 0)
532 g_warning ("Some widgets are still inside shell (%d widgets), they are:",
533 g_hash_table_size (win->widgets));
534 g_hash_table_foreach (win->widgets, (GHFunc)puts, NULL);
537 g_hash_table_destroy (win
->widgets
);
543 if (g_hash_table_size (win
->values
) > 0)
546 g_warning ("Some Values are still left in shell (%d Values), they are:",
547 g_hash_table_size (win->values));
548 g_hash_table_foreach (win->values, (GHFunc)puts, NULL);
551 g_hash_table_destroy (win
->values
);
555 g_object_unref (win
->ui
);
558 if (win
->preferences
)
560 g_object_unref (win
->preferences
);
561 win
->preferences
= NULL
;
563 if (win
->layout_manager
) {
564 /* Disconnect signal handlers so we don't get any signals after we're
566 g_signal_handlers_disconnect_by_func (win
->layout_manager
, on_layout_dirty_notify
,
568 g_signal_handlers_disconnect_by_func (gdl_dock_layout_get_master (win
->layout_manager
),
569 on_layout_locked_notify
, win
);
570 g_object_unref (win
->layout_manager
);
571 win
->layout_manager
= NULL
;
573 if (win
->profile_manager
) {
574 g_object_unref (G_OBJECT (win
->profile_manager
));
575 win
->profile_manager
= NULL
;
577 if (win
->plugin_manager
) {
578 g_object_unref (G_OBJECT (win
->plugin_manager
));
579 win
->plugin_manager
= NULL
;
582 g_object_unref (G_OBJECT (win
->status
));
587 g_object_unref (win
->settings
);
588 win
->settings
= NULL
;
591 G_OBJECT_CLASS (parent_class
)->dispose (widget
);
595 anjuta_window_instance_init (AnjutaWindow
*win
)
597 GtkWidget
*menubar
, *about_menu
;
598 GtkWidget
*view_menu
, *hbox
;
602 GList
*plugins_dirs
= NULL
;
603 GdkGeometry size_hints
= {
604 100, 100, 0, 0, 100, 100, 1, 1, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST
607 DEBUG_PRINT ("%s", "Initializing Anjuta...");
609 gtk_window_set_geometry_hints (GTK_WINDOW (win
), GTK_WIDGET (win
),
610 &size_hints
, GDK_HINT_RESIZE_INC
);
611 gtk_window_set_resizable (GTK_WINDOW (win
), TRUE
);
616 main_box
= gtk_box_new (GTK_ORIENTATION_VERTICAL
, 0);
617 gtk_container_add (GTK_CONTAINER (win
), main_box
);
618 gtk_widget_show (main_box
);
622 win
->maximized
= FALSE
;
625 win
->settings
= g_settings_new (PREF_SCHEMA
);
628 win
->status
= ANJUTA_STATUS (anjuta_status_new ());
629 anjuta_status_set_title_window (win
->status
, GTK_WIDGET (win
));
630 gtk_widget_show (GTK_WIDGET (win
->status
));
631 gtk_box_pack_end (GTK_BOX (main_box
),
632 GTK_WIDGET (win
->status
), FALSE
, TRUE
, 0);
633 g_object_ref (G_OBJECT (win
->status
));
634 g_object_add_weak_pointer (G_OBJECT (win
->status
), (gpointer
)&win
->status
);
637 hbox
= gtk_box_new (GTK_ORIENTATION_HORIZONTAL
, 0);
638 gtk_widget_show (hbox
);
639 win
->dock
= gdl_dock_new ();
640 gtk_widget_show (win
->dock
);
641 gtk_box_pack_end(GTK_BOX (hbox
), win
->dock
, TRUE
, TRUE
, 0);
643 dockbar
= gdl_dock_bar_new (G_OBJECT (win
->dock
));
644 gtk_widget_show (dockbar
);
645 gtk_box_pack_start(GTK_BOX (hbox
), dockbar
, FALSE
, FALSE
, 0);
647 win
->layout_manager
= gdl_dock_layout_new (G_OBJECT (win
->dock
));
648 g_signal_connect (win
->layout_manager
, "notify::dirty",
649 G_CALLBACK (on_layout_dirty_notify
), win
);
650 g_signal_connect (gdl_dock_layout_get_master (win
->layout_manager
), "notify::locked",
651 G_CALLBACK (on_layout_locked_notify
), win
);
654 win
->ui
= anjuta_ui_new ();
655 g_object_add_weak_pointer (G_OBJECT (win
->ui
), (gpointer
)&win
->ui
);
656 /* show tooltips in the statusbar */
657 g_signal_connect (win
->ui
,
659 G_CALLBACK (connect_proxy_cb
),
661 g_signal_connect (win
->ui
,
663 G_CALLBACK (disconnect_proxy_cb
),
667 plugins_dirs
= g_list_prepend (plugins_dirs
, PACKAGE_PLUGIN_DIR
);
668 win
->plugin_manager
= anjuta_plugin_manager_new (G_OBJECT (win
),
671 win
->profile_manager
= anjuta_profile_manager_new (win
->plugin_manager
);
672 g_list_free (plugins_dirs
);
675 win
->preferences
= anjuta_preferences_new (win
->plugin_manager
, PREF_SCHEMA
);
676 g_object_add_weak_pointer (G_OBJECT (win
->preferences
),
677 (gpointer
)&win
->preferences
);
679 g_signal_connect (win
->settings
, "changed::" GDL_STYLE
,
680 G_CALLBACK (on_gdl_style_changed
), win
);
681 on_gdl_style_changed (win
->settings
, GDL_STYLE
, win
);
683 /* Register actions */
684 anjuta_ui_add_action_group_entries (win
->ui
, "ActionGroupFile", _("File"),
686 G_N_ELEMENTS (menu_entries_file
),
687 GETTEXT_PACKAGE
, TRUE
, win
);
688 anjuta_ui_add_action_group_entries (win
->ui
, "ActionGroupEdit", _("Edit"),
690 G_N_ELEMENTS (menu_entries_edit
),
691 GETTEXT_PACKAGE
, TRUE
, win
);
692 anjuta_ui_add_action_group_entries (win
->ui
, "ActionGroupView", _("View"),
694 G_N_ELEMENTS (menu_entries_view
),
695 GETTEXT_PACKAGE
, TRUE
, win
);
696 anjuta_ui_add_toggle_action_group_entries (win
->ui
, "ActionGroupToggleView",
698 menu_entries_toggle_view
,
699 G_N_ELEMENTS (menu_entries_toggle_view
),
700 GETTEXT_PACKAGE
, TRUE
, win
);
701 anjuta_ui_add_action_group_entries (win
->ui
, "ActionGroupHelp", _("Help"),
703 G_N_ELEMENTS (menu_entries_help
),
704 GETTEXT_PACKAGE
, TRUE
, win
);
707 anjuta_ui_merge (win
->ui
, UI_FILE
);
709 /* Adding accels group */
710 gtk_window_add_accel_group (GTK_WINDOW (win
),
711 gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (win
->ui
)));
713 /* create main menu */
714 menubar
= gtk_ui_manager_get_widget (GTK_UI_MANAGER (win
->ui
),
716 gtk_box_pack_start (GTK_BOX (main_box
), menubar
, FALSE
, FALSE
, 0);
717 gtk_widget_show (menubar
);
720 win
->toolbar
= gtk_ui_manager_get_widget (GTK_UI_MANAGER (win
->ui
),
722 if (!g_settings_get_boolean (win
->settings
, TOOLBAR_VISIBLE
))
723 gtk_widget_hide (win
->toolbar
);
724 gtk_style_context_add_class (gtk_widget_get_style_context (win
->toolbar
),
725 GTK_STYLE_CLASS_PRIMARY_TOOLBAR
);
726 gtk_toolbar_set_icon_size (GTK_TOOLBAR (win
->toolbar
),
728 gtk_box_pack_start (GTK_BOX (main_box
), win
->toolbar
, FALSE
, FALSE
, 0);
729 action
= gtk_ui_manager_get_action (GTK_UI_MANAGER (win
->ui
),
730 "/MenuMain/MenuView/Toolbar");
731 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action
),
732 g_settings_get_boolean (win
->settings
,
734 g_signal_connect (win
->settings
, "changed::" TOOLBAR_STYLE
,
735 G_CALLBACK (on_toolbar_style_changed
), win
);
736 on_toolbar_style_changed (win
->settings
, TOOLBAR_STYLE
, win
);
738 /* Create widgets menu */
740 gtk_ui_manager_get_widget (GTK_UI_MANAGER(win
->ui
),
741 "/MenuMain/MenuView");
742 win
->view_menu
= gtk_menu_item_get_submenu (GTK_MENU_ITEM (view_menu
));
744 /* Create about plugins menu */
746 gtk_ui_manager_get_widget (GTK_UI_MANAGER(win
->ui
),
747 "/MenuMain/PlaceHolderHelpMenus/MenuHelp/"
748 "PlaceHolderHelpAbout/AboutPlugins");
749 about_create_plugins_submenu (ANJUTA_SHELL (win
), about_menu
);
752 gtk_box_pack_start (GTK_BOX (main_box
), hbox
, TRUE
, TRUE
, 0);
754 /* Connect to session */
755 g_signal_connect (G_OBJECT (win
), "save_session",
756 G_CALLBACK (on_session_save
), win
);
757 g_signal_connect (G_OBJECT (win
), "load_session",
758 G_CALLBACK (on_session_load
), win
);
761 anjuta_ui_load_accels (NULL
);
767 * GtkWindow catches keybindings for the menu items _before_ passing them to
768 * the focused widget. This is unfortunate and means that pressing ctrl+V
769 * in an entry on a panel ends up pasting text in the TextView.
770 * Here we override GtkWindow's handler to do the same things that it
771 * does, but in the opposite order and then we chain up to the grand
772 * parent handler, skipping gtk_window_key_press_event.
775 anjuta_window_key_press_event (GtkWidget
*widget
,
778 static gpointer grand_parent_class
= NULL
;
779 GtkWindow
*window
= GTK_WINDOW (widget
);
780 GtkWidget
*focus
= gtk_window_get_focus (window
);
781 gboolean handled
= FALSE
;
783 if (grand_parent_class
== NULL
)
784 grand_parent_class
= g_type_class_peek_parent (parent_class
);
786 /* Special case the editor - it catches all shortcuts otherwise */
787 if (GTK_SOURCE_IS_VIEW (focus
))
788 if (gtk_window_activate_key (window
, event
))
790 switch (event
->keyval
)
804 /* handle mnemonics and accelerators */
806 handled
= gtk_window_activate_key (window
, event
);
809 /* handle focus widget key events */
811 handled
= gtk_window_propagate_key_event (window
, event
);
814 /* handle mnemonics and accelerators */
816 handled
= gtk_window_activate_key (window
, event
);
818 /* Chain up, invokes binding set */
820 handled
= GTK_WIDGET_CLASS (grand_parent_class
)->key_press_event (widget
, event
);
826 anjuta_window_class_init (AnjutaWindowClass
*class)
828 GObjectClass
*object_class
;
829 GtkWidgetClass
*widget_class
;
831 parent_class
= g_type_class_peek_parent (class);
832 object_class
= (GObjectClass
*) class;
833 widget_class
= (GtkWidgetClass
*) class;
835 object_class
->dispose
= anjuta_window_dispose
;
837 widget_class
->key_press_event
= anjuta_window_key_press_event
;
841 anjuta_window_new (GtkApplication
* app
)
845 win
= ANJUTA_WINDOW (g_object_new (ANJUTA_TYPE_WINDOW
,
849 return GTK_WIDGET (win
);
853 anjuta_window_get_geometry (AnjutaWindow
*win
)
856 gint width
, height
, posx
, posy
;
858 g_return_val_if_fail (ANJUTA_IS_WINDOW (win
), NULL
);
861 width
= height
= posx
= posy
= 0;
862 if (gtk_widget_get_window (GTK_WIDGET (win
)))
864 gtk_window_get_size (GTK_WINDOW (win
), &width
, &height
);
865 gtk_window_get_position (GTK_WINDOW(win
), &posx
, &posy
);
867 geometry
= g_strdup_printf ("%dx%d+%d+%d", width
, height
, posx
, posy
);
873 anjuta_window_set_geometry (AnjutaWindow
*win
, const gchar
*geometry
)
875 gint width
, height
, posx
, posy
;
876 gboolean geometry_set
= FALSE
;
878 if (geometry
&& strlen (geometry
) > 0)
880 DEBUG_PRINT ("Setting geometry: %s", geometry
);
882 if (sscanf (geometry
, "%dx%d+%d+%d", &width
, &height
,
885 if (gtk_widget_get_realized (GTK_WIDGET (win
)))
887 gtk_window_resize (GTK_WINDOW (win
), width
, height
);
891 gtk_window_set_default_size (GTK_WINDOW (win
), width
, height
);
892 gtk_window_move (GTK_WINDOW (win
), posx
, posy
);
898 g_warning ("Failed to parse geometry: %s", geometry
);
905 width
= gdk_screen_width () - WIDTH_MARGIN
;
906 height
= gdk_screen_height () - HEIGHT_MARGIN
;
907 width
= (width
< DEFAULT_WIDTH
)? width
: DEFAULT_WIDTH
;
908 height
= (height
< DEFAULT_HEIGHT
)? width
: DEFAULT_HEIGHT
;
909 if (gtk_widget_get_realized (GTK_WIDGET (win
)) == FALSE
)
911 gtk_window_set_default_size (GTK_WINDOW (win
), width
, height
);
912 gtk_window_move (GTK_WINDOW (win
), posx
, posy
);
918 anjuta_window_layout_save (AnjutaWindow
*win
, const gchar
*filename
,
921 g_return_if_fail (ANJUTA_IS_WINDOW (win
));
922 g_return_if_fail (filename
!= NULL
);
924 /* If maximized, the layout should be loaded from the back-up first */
926 gdl_dock_layout_load_layout (win
->layout_manager
, "back-up");
928 /* Continue with the saving */
929 gdl_dock_layout_save_layout (win
->layout_manager
, name
);
930 if (!gdl_dock_layout_save_to_file (win
->layout_manager
, filename
))
931 g_warning ("Saving dock layout to '%s' failed!", filename
);
933 /* This is a good place to save the accels too */
934 anjuta_ui_save_accels (NULL
);
938 anjuta_window_layout_load (AnjutaWindow
*win
, const gchar
*layout_filename
,
941 g_return_if_fail (ANJUTA_IS_WINDOW (win
));
943 if (!layout_filename
||
944 !gdl_dock_layout_load_from_file (win
->layout_manager
, layout_filename
))
946 gchar
*datadir
, *filename
;
947 datadir
= anjuta_res_get_data_dir();
949 filename
= g_build_filename (datadir
, "layout.xml", NULL
);
950 DEBUG_PRINT ("Layout = %s", filename
);
952 if (!gdl_dock_layout_load_from_file (win
->layout_manager
, filename
))
953 g_warning ("Loading layout from '%s' failed!!", filename
);
957 if (!gdl_dock_layout_load_layout (win
->layout_manager
, name
))
958 g_warning ("Loading layout failed!!");
960 /* Layout loaded from file are not maximized */
961 win
->maximized
= FALSE
;
965 anjuta_window_layout_reset (AnjutaWindow
*win
)
967 anjuta_window_layout_load (win
, NULL
, NULL
);
971 anjuta_window_install_preferences (AnjutaWindow
*win
)
973 GtkBuilder
* builder
= gtk_builder_new ();
974 GError
* error
= NULL
;
975 GtkWidget
*notebook
, *shortcuts
, *plugins
, *remember_plugins
;
977 /* Create preferences page */
978 gtk_builder_add_from_file (builder
, GLADE_FILE
, &error
);
981 g_warning("Could not load general preferences: %s",
983 g_error_free (error
);
986 anjuta_preferences_add_from_builder (win
->preferences
, builder
, win
->settings
,
987 "General", _("General"), ICON_FILE
);
988 notebook
= GTK_WIDGET (gtk_builder_get_object (builder
, "General"));
989 shortcuts
= anjuta_ui_get_accel_editor (ANJUTA_UI (win
->ui
));
990 plugins
= anjuta_plugin_manager_get_plugins_page (win
->plugin_manager
);
991 remember_plugins
= anjuta_plugin_manager_get_remembered_plugins_page (win
->plugin_manager
);
993 gtk_widget_show (shortcuts
);
994 gtk_widget_show (plugins
);
995 gtk_widget_show (remember_plugins
);
997 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), plugins
,
998 gtk_label_new (_("Installed plugins")));
999 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), remember_plugins
,
1000 gtk_label_new (_("Preferred plugins")));
1001 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), shortcuts
,
1002 gtk_label_new (_("Shortcuts")));
1004 g_object_unref (builder
);
1007 /* AnjutaShell Implementation */
1010 on_value_removed_from_hash (gpointer value
)
1012 g_value_unset ((GValue
*)value
);
1017 anjuta_window_add_value (AnjutaShell
*shell
, const char *name
,
1018 const GValue
*value
, GError
**error
)
1023 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
1024 g_return_if_fail (name
!= NULL
);
1025 g_return_if_fail (G_IS_VALUE(value
));
1027 win
= ANJUTA_WINDOW (shell
);
1029 if (win
->values
== NULL
)
1031 win
->values
= g_hash_table_new_full (g_str_hash
, g_str_equal
, g_free
,
1032 on_value_removed_from_hash
);
1034 anjuta_shell_remove_value (shell
, name
, error
);
1036 copy
= g_new0 (GValue
, 1);
1037 g_value_init (copy
, value
->g_type
);
1038 g_value_copy (value
, copy
);
1040 g_hash_table_insert (win
->values
, g_strdup (name
), copy
);
1041 g_signal_emit_by_name (shell
, "value_added", name
, copy
);
1045 anjuta_window_get_value (AnjutaShell
*shell
, const char *name
, GValue
*value
,
1051 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
1052 g_return_if_fail (name
!= NULL
);
1053 /* g_return_if_fail (G_IS_VALUE (value)); */
1055 win
= ANJUTA_WINDOW (shell
);
1059 val
= g_hash_table_lookup (win
->values
, name
);
1064 g_value_init (value
, val
->g_type
);
1066 g_value_copy (val
, value
);
1072 *error
= g_error_new (ANJUTA_SHELL_ERROR
,
1073 ANJUTA_SHELL_ERROR_DOESNT_EXIST
,
1074 _("Value doesn't exist"));
1080 anjuta_window_remove_value (AnjutaShell
*shell
, const char *name
, GError
**error
)
1086 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
1087 g_return_if_fail (name
!= NULL
);
1089 win
= ANJUTA_WINDOW (shell
);
1092 g_return_if_fail (win->values != NULL);
1093 if (win->widgets && g_hash_table_lookup_extended (win->widgets, name,
1097 item = g_object_get_data (G_OBJECT (w), "dockitem");
1098 gdl_dock_item_hide_item (GDL_DOCK_ITEM (item));
1099 gdl_dock_object_unbind (GDL_DOCK_OBJECT (item));
1104 if (win
->values
&& g_hash_table_lookup_extended (win
->values
, name
,
1106 (gpointer
)&value
)) {
1107 g_signal_emit_by_name (win
, "value_removed", name
);
1108 g_hash_table_remove (win
->values
, name
);
1113 anjuta_window_saving_push (AnjutaShell
* shell
)
1115 AnjutaWindow
* win
= ANJUTA_WINDOW (shell
);
1120 anjuta_window_saving_pop (AnjutaShell
* shell
)
1122 AnjutaWindow
* win
= ANJUTA_WINDOW (shell
);
1127 remove_from_widgets_hash (gpointer name
, gpointer hash_widget
, gpointer widget
)
1129 if (hash_widget
== widget
)
1135 on_widget_destroy (GtkWidget
*widget
, AnjutaWindow
*win
)
1137 DEBUG_PRINT ("%s", "Widget about to be destroyed");
1138 g_hash_table_foreach_remove (win
->widgets
, remove_from_widgets_hash
,
1143 on_widget_remove (GtkWidget
*container
, GtkWidget
*widget
, AnjutaWindow
*win
)
1145 GtkWidget
*dock_item
;
1147 dock_item
= g_object_get_data (G_OBJECT (widget
), "dockitem");
1150 gchar
* unique_name
= g_object_get_data(G_OBJECT(dock_item
), "unique_name");
1151 g_free(unique_name
);
1152 g_signal_handlers_disconnect_by_func (G_OBJECT (dock_item
),
1153 G_CALLBACK (on_widget_remove
), win
);
1155 if (g_hash_table_foreach_remove (win
->widgets
,
1156 remove_from_widgets_hash
,
1158 DEBUG_PRINT ("%s", "Widget removed from container");
1163 on_widget_removed_from_hash (gpointer widget
)
1166 GtkWidget
*menuitem
;
1167 GdlDockItem
*dockitem
;
1169 DEBUG_PRINT ("%s", "Removing widget from hash");
1171 win
= g_object_get_data (G_OBJECT (widget
), "app-object");
1172 dockitem
= g_object_get_data (G_OBJECT (widget
), "dockitem");
1173 menuitem
= g_object_get_data (G_OBJECT (widget
), "menuitem");
1175 gtk_widget_destroy (menuitem
);
1177 g_object_set_data (G_OBJECT (widget
), "dockitem", NULL
);
1178 g_object_set_data (G_OBJECT (widget
), "menuitem", NULL
);
1180 g_signal_handlers_disconnect_by_func (G_OBJECT (widget
),
1181 G_CALLBACK (on_widget_destroy
), win
);
1182 g_signal_handlers_disconnect_by_func (G_OBJECT (dockitem
),
1183 G_CALLBACK (on_widget_remove
), win
);
1185 g_object_unref (G_OBJECT (widget
));
1189 anjuta_window_setup_widget (AnjutaWindow
* win
,
1196 GtkCheckMenuItem
* menuitem
;
1198 /* Add the widget to hash */
1199 if (win
->widgets
== NULL
)
1201 win
->widgets
= g_hash_table_new_full (g_str_hash
, g_str_equal
,
1203 on_widget_removed_from_hash
);
1205 g_hash_table_insert (win
->widgets
, g_strdup (name
), widget
);
1206 g_object_ref (widget
);
1208 /* Add toggle button for the widget */
1209 menuitem
= GTK_CHECK_MENU_ITEM (gtk_check_menu_item_new_with_label (title
));
1210 gtk_widget_show (GTK_WIDGET (menuitem
));
1211 gtk_check_menu_item_set_active (menuitem
, TRUE
);
1212 gtk_menu_shell_append (GTK_MENU_SHELL (win
->view_menu
), GTK_WIDGET (menuitem
));
1215 g_object_set( G_OBJECT(menuitem
), "visible", FALSE
, NULL
);
1218 g_object_set_data (G_OBJECT (widget
), "app-object", win
);
1219 g_object_set_data (G_OBJECT (widget
), "menuitem", menuitem
);
1220 g_object_set_data (G_OBJECT (widget
), "dockitem", item
);
1222 /* For toggling widget view on/off */
1223 g_signal_connect (G_OBJECT (menuitem
), "toggled",
1224 G_CALLBACK (on_toggle_widget_view
), item
);
1227 Watch for widget removal/destruction so that it could be
1228 removed from widgets hash.
1230 g_signal_connect (G_OBJECT (item
), "remove",
1231 G_CALLBACK (on_widget_remove
), win
);
1232 g_signal_connect_after (G_OBJECT (widget
), "destroy",
1233 G_CALLBACK (on_widget_destroy
), win
);
1235 gtk_widget_show (item
);
1240 anjuta_window_add_widget_full (AnjutaShell
*shell
,
1244 const char *stock_id
,
1245 AnjutaShellPlacement placement
,
1252 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
1253 g_return_if_fail (GTK_IS_WIDGET (widget
));
1254 g_return_if_fail (name
!= NULL
);
1255 g_return_if_fail (title
!= NULL
);
1257 win
= ANJUTA_WINDOW (shell
);
1259 /* Add the widget to dock */
1260 if (stock_id
== NULL
)
1261 item
= gdl_dock_item_new (name
, title
, GDL_DOCK_ITEM_BEH_NORMAL
);
1263 item
= gdl_dock_item_new_with_stock (name
, title
, stock_id
,
1264 GDL_DOCK_ITEM_BEH_NORMAL
);
1268 flags
|= GDL_DOCK_ITEM_BEH_NEVER_FLOATING
;
1269 flags
|= GDL_DOCK_ITEM_BEH_CANT_CLOSE
;
1270 flags
|= GDL_DOCK_ITEM_BEH_CANT_ICONIFY
;
1271 flags
|= GDL_DOCK_ITEM_BEH_NO_GRIP
;
1272 g_object_set(G_OBJECT(item
), "behavior", flags
, NULL
);
1275 gtk_container_add (GTK_CONTAINER (item
), widget
);
1276 gdl_dock_add_item (GDL_DOCK (win
->dock
),
1277 GDL_DOCK_ITEM (item
), placement
);
1280 gdl_dock_item_set_default_position(GDL_DOCK_ITEM(item
), GDL_DOCK_OBJECT(win
->dock
));
1282 anjuta_window_setup_widget (win
, name
, widget
, item
, title
, locked
);
1286 anjuta_window_add_widget_custom (AnjutaShell
*shell
,
1290 const char *stock_id
,
1292 AnjutaShellPlacement placement
,
1299 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
1300 g_return_if_fail (GTK_IS_WIDGET (widget
));
1301 g_return_if_fail (name
!= NULL
);
1302 g_return_if_fail (title
!= NULL
);
1304 win
= ANJUTA_WINDOW (shell
);
1306 /* Add the widget to dock */
1307 /* Add the widget to dock */
1308 if (stock_id
== NULL
)
1309 item
= gdl_dock_item_new (name
, title
, GDL_DOCK_ITEM_BEH_NORMAL
);
1311 item
= gdl_dock_item_new_with_stock (name
, title
, stock_id
,
1312 GDL_DOCK_ITEM_BEH_NORMAL
);
1314 gtk_container_add (GTK_CONTAINER (item
), widget
);
1315 gdl_dock_add_item (GDL_DOCK (win
->dock
),
1316 GDL_DOCK_ITEM (item
), placement
);
1318 grip
= gdl_dock_item_get_grip (GDL_DOCK_ITEM (item
));
1320 gdl_dock_item_grip_set_label (GDL_DOCK_ITEM_GRIP (grip
), label
);
1322 anjuta_window_setup_widget (win
, name
, widget
, item
, title
, FALSE
);
1326 anjuta_window_remove_widget (AnjutaShell
*shell
, GtkWidget
*widget
,
1330 GtkWidget
*dock_item
;
1332 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
1333 g_return_if_fail (GTK_IS_WIDGET (widget
));
1335 win
= ANJUTA_WINDOW (shell
);
1337 g_return_if_fail (win
->widgets
!= NULL
);
1339 dock_item
= g_object_get_data (G_OBJECT (widget
), "dockitem");
1340 g_return_if_fail (dock_item
!= NULL
);
1342 /* Remove the widget from container */
1343 g_object_ref (widget
);
1344 /* It should call on_widget_remove() and clean up should happen */
1345 gtk_container_remove (GTK_CONTAINER (dock_item
), widget
);
1346 g_object_unref (widget
);
1347 gdl_dock_item_unbind (GDL_DOCK_ITEM(dock_item
));
1351 anjuta_window_present_widget (AnjutaShell
*shell
, GtkWidget
*widget
,
1355 GdlDockItem
*dock_item
;
1358 g_return_if_fail (ANJUTA_IS_WINDOW (shell
));
1359 g_return_if_fail (GTK_IS_WIDGET (widget
));
1361 win
= ANJUTA_WINDOW (shell
);
1363 g_return_if_fail (win
->widgets
!= NULL
);
1365 dock_item
= g_object_get_data (G_OBJECT(widget
), "dockitem");
1366 g_return_if_fail (dock_item
!= NULL
);
1368 /* Hack to present the dock item if it's in a notebook dock item */
1369 parent
= gtk_widget_get_parent (GTK_WIDGET(dock_item
) );
1370 if (!GDL_DOCK_OBJECT_ATTACHED (dock_item
))
1372 gdl_dock_item_show_item (GDL_DOCK_ITEM (dock_item
));
1374 if (GTK_IS_NOTEBOOK (parent
))
1377 pagenum
= gtk_notebook_page_num (GTK_NOTEBOOK (parent
), GTK_WIDGET (dock_item
));
1378 gtk_notebook_set_current_page (GTK_NOTEBOOK (parent
), pagenum
);
1381 /* FIXME: If the item is floating, present the window */
1382 /* FIXME: There is no way to detect if a widget was floating before it was
1383 detached since it no longer has a parent there is no way to access the
1384 floating property of the GdlDock structure.*/
1388 anjuta_window_get_object (AnjutaShell
*shell
, const char *iface_name
,
1391 g_return_val_if_fail (ANJUTA_IS_WINDOW (shell
), NULL
);
1392 g_return_val_if_fail (iface_name
!= NULL
, NULL
);
1393 return anjuta_plugin_manager_get_plugin (ANJUTA_WINDOW (shell
)->plugin_manager
,
1397 static AnjutaStatus
*
1398 anjuta_window_get_status (AnjutaShell
*shell
, GError
**error
)
1400 g_return_val_if_fail (ANJUTA_IS_WINDOW (shell
), NULL
);
1401 return ANJUTA_WINDOW (shell
)->status
;
1405 anjuta_window_get_ui (AnjutaShell
*shell
, GError
**error
)
1407 g_return_val_if_fail (ANJUTA_IS_WINDOW (shell
), NULL
);
1408 return ANJUTA_WINDOW (shell
)->ui
;
1411 static AnjutaPreferences
*
1412 anjuta_window_get_preferences (AnjutaShell
*shell
, GError
**error
)
1414 g_return_val_if_fail (ANJUTA_IS_WINDOW (shell
), NULL
);
1415 return ANJUTA_WINDOW (shell
)->preferences
;
1418 static AnjutaPluginManager
*
1419 anjuta_window_get_plugin_manager (AnjutaShell
*shell
, GError
**error
)
1421 g_return_val_if_fail (ANJUTA_IS_WINDOW (shell
), NULL
);
1422 return ANJUTA_WINDOW (shell
)->plugin_manager
;
1425 static AnjutaProfileManager
*
1426 anjuta_window_get_profile_manager (AnjutaShell
*shell
, GError
**error
)
1428 g_return_val_if_fail (ANJUTA_IS_WINDOW (shell
), NULL
);
1429 return ANJUTA_WINDOW (shell
)->profile_manager
;
1433 anjuta_shell_iface_init (AnjutaShellIface
*iface
)
1435 iface
->add_widget_full
= anjuta_window_add_widget_full
;
1436 iface
->add_widget_custom
= anjuta_window_add_widget_custom
;
1437 iface
->remove_widget
= anjuta_window_remove_widget
;
1438 iface
->present_widget
= anjuta_window_present_widget
;
1439 iface
->iconify_dockable_widget
= anjuta_window_iconify_dockable_widget
;
1440 iface
->hide_dockable_widget
= anjuta_window_hide_dockable_widget
;
1441 iface
->show_dockable_widget
= anjuta_window_show_dockable_widget
;
1442 iface
->maximize_widget
= anjuta_window_maximize_widget
;
1443 iface
->unmaximize
= anjuta_window_unmaximize
;
1444 iface
->create_window
= anjuta_window_create_window
;
1445 iface
->add_value
= anjuta_window_add_value
;
1446 iface
->get_value
= anjuta_window_get_value
;
1447 iface
->remove_value
= anjuta_window_remove_value
;
1448 iface
->get_object
= anjuta_window_get_object
;
1449 iface
->get_status
= anjuta_window_get_status
;
1450 iface
->get_ui
= anjuta_window_get_ui
;
1451 iface
->get_preferences
= anjuta_window_get_preferences
;
1452 iface
->get_plugin_manager
= anjuta_window_get_plugin_manager
;
1453 iface
->get_profile_manager
= anjuta_window_get_profile_manager
;
1454 iface
->saving_push
= anjuta_window_saving_push
;
1455 iface
->saving_pop
= anjuta_window_saving_pop
;
1458 ANJUTA_TYPE_BEGIN(AnjutaWindow
, anjuta_window
, GTK_TYPE_APPLICATION_WINDOW
);
1459 ANJUTA_TYPE_ADD_INTERFACE(anjuta_shell
, ANJUTA_TYPE_SHELL
);