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
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
12 his program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 #include <libgnomeui/gnome-window-icon.h>
37 #include <libanjuta/anjuta-utils.h>
38 #include <libanjuta/resources.h>
40 #include "anjuta-app.h"
43 #include "action-callbacks.h"
47 on_exit1_activate (GtkAction
* action
, AnjutaApp
*app
)
49 GdkEvent
*event
= gdk_event_new (GDK_DELETE
);
51 event
->any
.window
= g_object_ref (GTK_WIDGET(app
)->window
);
52 event
->any
.send_event
= TRUE
;
54 gtk_main_do_event (event
);
55 gdk_event_free (event
);
59 on_fullscreen_toggle (GtkAction
*action
, AnjutaApp
*app
)
61 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action
)))
62 gtk_window_fullscreen (GTK_WINDOW(app
));
64 gtk_window_unfullscreen (GTK_WINDOW(app
));
68 on_layout_lock_toggle (GtkAction
*action
, AnjutaApp
*app
)
70 if (app
->layout_manager
)
71 g_object_set (app
->layout_manager
->master
, "locked",
72 gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action
)),
77 on_reset_layout_activate(GtkAction
*action
, AnjutaApp
*app
)
79 anjuta_app_layout_reset (app
);
83 on_set_preferences1_activate (GtkAction
* action
, AnjutaApp
*app
)
85 gtk_widget_show (GTK_WIDGET (app
->preferences
));
89 on_set_default_preferences1_activate (GtkAction
* action
,
92 anjuta_preferences_reset_defaults (ANJUTA_PREFERENCES (app
->preferences
));
96 on_customize_shortcuts_activate(GtkAction
*action
, AnjutaApp
*app
)
98 GtkWidget
*win
, *accel_editor
;
100 accel_editor
= anjuta_ui_get_accel_editor (ANJUTA_UI (app
->ui
));
101 win
= gtk_dialog_new_with_buttons (_("Anjuta Plugins"), GTK_WINDOW (app
),
102 GTK_DIALOG_DESTROY_WITH_PARENT
,
103 GTK_STOCK_CLOSE
, GTK_STOCK_CANCEL
, NULL
);
104 gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG(win
)->vbox
), accel_editor
);
105 gtk_window_set_default_size (GTK_WINDOW (win
), 500, 400);
106 gtk_dialog_run (GTK_DIALOG (win
));
107 gtk_widget_destroy (win
);
111 on_show_plugins_activate (GtkAction
*action
, AnjutaApp
*app
)
113 GtkWidget
*win
, *plg
;
115 plg
= anjuta_plugin_manager_get_dialog (app
->plugin_manager
);
116 win
= gtk_dialog_new_with_buttons (_("Anjuta Plugins"), GTK_WINDOW (app
),
117 GTK_DIALOG_DESTROY_WITH_PARENT
,
118 GTK_STOCK_CLOSE
, GTK_STOCK_CANCEL
, NULL
);
119 gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG(win
)->vbox
), plg
);
120 gtk_window_set_default_size (GTK_WINDOW(win
), 500, 550);
121 gtk_dialog_run (GTK_DIALOG (win
));
122 gtk_widget_destroy (win
);
126 help_activate (const gchar
*doc_id
, const gchar
*item
)
128 if (gnome_help_display_with_doc_id (NULL
, doc_id
, item
, NULL
, NULL
) == FALSE
)
130 anjuta_util_dialog_error (NULL
, _("Unable to display help. Please make sure Anjuta documentation package is install. It can be downloaded from http://anjuta.org"));
135 on_help_manual_activate (GtkAction
*action
, gpointer data
)
137 help_activate ("anjuta-manual", "anjuta-manual.xml");
141 on_help_tutorial_activate (GtkAction
*action
, gpointer data
)
143 help_activate ("anjuta-tutorial", "anjuta-tutorial.xml");
147 on_help_advanced_tutorial_activate (GtkAction
*action
, gpointer data
)
149 help_activate ("anjuta-advanced-tutorial", "anjuta-advanced-tutorial.xml");
153 on_help_faqs_activate (GtkAction
*action
, gpointer data
)
155 help_activate ("anjuta-faqs", "anjuta-faqs.xml");
159 on_url_home_activate (GtkAction
* action
, gpointer user_data
)
161 anjuta_res_url_show("http://www.anjuta.org");
165 on_url_bugs_activate (GtkAction
* action
, gpointer user_data
)
167 anjuta_res_url_show("http://bugzilla.gnome.org/simple-bug-guide.cgi");
171 on_url_faqs_activate (GtkAction
* action
, gpointer user_data
)
173 anjuta_res_url_show("mailto:anjuta-list@lists.sourceforge.net");
177 on_about_activate (GtkAction
* action
, gpointer user_data
)
179 GtkWidget
*about_dlg
= about_box_new ();
181 g_signal_connect_swapped(about_dlg
, "response",
182 G_CALLBACK(gtk_widget_destroy
), about_dlg
);
184 gtk_widget_show (about_dlg
);