1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
4 * (GLABELS) Label and Business Card Creation program for GNOME
6 * ui-commands.c: GLabels UI commands module
8 * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include "ui-commands.h"
29 #include <glib/gi18n.h>
30 #include <gtk/gtkwindow.h>
31 #include <gtk/gtkaboutdialog.h>
32 #include <libgnome/gnome-help.h>
36 #include "template-designer.h"
39 #include "prefs-dialog.h"
45 /****************************************************************************/
46 /** File/New command. */
47 /****************************************************************************/
49 gl_ui_cmd_file_new (GtkAction *action,
52 gl_debug (DEBUG_COMMANDS, "START");
54 g_return_if_fail (action && GTK_IS_ACTION(action));
55 g_return_if_fail (window && GL_IS_WINDOW(window));
59 gl_debug (DEBUG_COMMANDS, "END");
62 /****************************************************************************/
63 /** File/Properties command. */
64 /****************************************************************************/
66 gl_ui_cmd_file_properties (GtkAction *action,
69 gl_debug (DEBUG_COMMANDS, "START");
71 g_return_if_fail (action && GTK_IS_ACTION(action));
72 g_return_if_fail (window && GL_IS_WINDOW(window));
74 gl_file_properties (GL_VIEW(window->view)->label, window);
76 gl_debug (DEBUG_COMMANDS, "END");
79 /****************************************************************************/
80 /** File/Template-Designer command. */
81 /****************************************************************************/
83 gl_ui_cmd_file_template_designer (GtkAction *action,
88 gl_debug (DEBUG_COMMANDS, "START");
90 g_return_if_fail (action && GTK_IS_ACTION(action));
91 g_return_if_fail (window && GL_IS_WINDOW(window));
93 dialog = gl_template_designer_new (GTK_WINDOW(window));
95 gtk_widget_show (dialog);
97 gl_debug (DEBUG_COMMANDS, "END");
100 /****************************************************************************/
101 /** File/Open command. */
102 /****************************************************************************/
104 gl_ui_cmd_file_open (GtkAction *action,
107 gl_debug (DEBUG_COMMANDS, "START");
109 g_return_if_fail (action && GTK_IS_ACTION(action));
110 g_return_if_fail (window && GL_IS_WINDOW(window));
112 gl_file_open (window);
114 gl_debug (DEBUG_COMMANDS, "END");
117 /****************************************************************************/
118 /** File/Open-Recent command. */
119 /****************************************************************************/
121 gl_ui_cmd_file_open_recent (GtkRecentChooser *chooser,
125 gchar *utf8_filename;
127 gl_debug (DEBUG_COMMANDS, "START");
129 g_return_if_fail (chooser && GTK_IS_RECENT_CHOOSER(chooser));
130 g_return_if_fail (window && GL_IS_WINDOW(window));
132 item = gtk_recent_chooser_get_current_item (chooser);
136 utf8_filename = gl_recent_get_utf8_filename (item);
138 gl_debug (DEBUG_COMMANDS, "Selected %s\n", utf8_filename);
139 gl_file_open_recent (utf8_filename, window);
141 gtk_recent_info_unref (item);
143 gl_debug (DEBUG_COMMANDS, "END");
146 /****************************************************************************/
147 /** File/Save command. */
148 /****************************************************************************/
150 gl_ui_cmd_file_save (GtkAction *action,
153 gl_debug (DEBUG_COMMANDS, "START");
155 g_return_if_fail (action && GTK_IS_ACTION(action));
156 g_return_if_fail (window && GL_IS_WINDOW(window));
158 gl_file_save (GL_VIEW(window->view)->label, window);
160 gl_debug (DEBUG_COMMANDS, "END");
163 /****************************************************************************/
164 /** File/Save-as command. */
165 /****************************************************************************/
167 gl_ui_cmd_file_save_as (GtkAction *action,
170 gl_debug (DEBUG_COMMANDS, "START");
172 g_return_if_fail (action && GTK_IS_ACTION(action));
173 g_return_if_fail (window && GL_IS_WINDOW(window));
175 gl_file_save_as (GL_VIEW(window->view)->label, window);
177 gl_debug (DEBUG_COMMANDS, "END");
180 /****************************************************************************/
181 /** File/Print command. */
182 /****************************************************************************/
184 gl_ui_cmd_file_print (GtkAction *action,
188 GtkPrintOperationResult result;
190 gl_debug (DEBUG_COMMANDS, "START");
192 g_return_if_fail (action && GTK_IS_ACTION(action));
193 g_return_if_fail (window && GL_IS_WINDOW(window));
195 op = gl_print_op_new (GL_VIEW(window->view)->label);
197 if (window->print_settings)
199 gl_print_op_set_settings (op, window->print_settings);
202 result = gtk_print_operation_run (GTK_PRINT_OPERATION (op),
203 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
207 if ( result == GTK_PRINT_OPERATION_RESULT_APPLY )
209 gl_print_op_free_settings (window->print_settings);
210 window->print_settings = gl_print_op_get_settings (op);
213 gl_debug (DEBUG_COMMANDS, "END");
216 /****************************************************************************/
217 /** File/Close command. */
218 /****************************************************************************/
220 gl_ui_cmd_file_close (GtkAction *action,
223 gl_debug (DEBUG_COMMANDS, "START");
225 g_return_if_fail (action && GTK_IS_ACTION(action));
226 g_return_if_fail (window && GL_IS_WINDOW(window));
228 gl_file_close (window);
230 gl_debug (DEBUG_COMMANDS, "END");
233 /****************************************************************************/
234 /** File/Quit command. */
235 /****************************************************************************/
237 gl_ui_cmd_file_quit (GtkAction *action,
240 gl_debug (DEBUG_COMMANDS, "START");
242 g_return_if_fail (action && GTK_IS_ACTION(action));
243 g_return_if_fail (window && GL_IS_WINDOW(window));
247 gl_debug (DEBUG_COMMANDS, "END");
251 /****************************************************************************/
252 /** Edit/Cut command. */
253 /****************************************************************************/
255 gl_ui_cmd_edit_cut (GtkAction *action,
258 gl_debug (DEBUG_COMMANDS, "START");
260 g_return_if_fail (action && GTK_IS_ACTION(action));
261 g_return_if_fail (window && GL_IS_WINDOW(window));
263 gl_view_cut (GL_VIEW(window->view));
265 gl_debug (DEBUG_COMMANDS, "END");
268 /****************************************************************************/
269 /** Edit/Copy command. */
270 /****************************************************************************/
272 gl_ui_cmd_edit_copy (GtkAction *action,
275 gl_debug (DEBUG_COMMANDS, "START");
277 g_return_if_fail (action && GTK_IS_ACTION(action));
278 g_return_if_fail (window && GL_IS_WINDOW(window));
280 gl_view_copy (GL_VIEW(window->view));
282 gl_debug (DEBUG_COMMANDS, "END");
285 /****************************************************************************/
286 /** Edit/Paste command. */
287 /****************************************************************************/
289 gl_ui_cmd_edit_paste (GtkAction *action,
292 gl_debug (DEBUG_COMMANDS, "START");
294 g_return_if_fail (action && GTK_IS_ACTION(action));
295 g_return_if_fail (window && GL_IS_WINDOW(window));
297 gl_view_paste (GL_VIEW(window->view));
299 gl_debug (DEBUG_COMMANDS, "END");
303 /****************************************************************************/
304 /** Edit/Delete command. */
305 /****************************************************************************/
307 gl_ui_cmd_edit_delete (GtkAction *action,
310 gl_debug (DEBUG_COMMANDS, "START");
312 g_return_if_fail (action && GTK_IS_ACTION(action));
313 g_return_if_fail (window && GL_IS_WINDOW(window));
315 gl_view_delete_selection (GL_VIEW(window->view));
317 gl_debug (DEBUG_COMMANDS, "END");
321 /****************************************************************************/
322 /** Edit/Select-all command. */
323 /****************************************************************************/
325 gl_ui_cmd_edit_select_all (GtkAction *action,
328 gl_debug (DEBUG_COMMANDS, "START");
330 g_return_if_fail (action && GTK_IS_ACTION(action));
331 g_return_if_fail (window && GL_IS_WINDOW(window));
333 gl_view_select_all (GL_VIEW(window->view));
335 gl_debug (DEBUG_COMMANDS, "END");
338 /****************************************************************************/
339 /** Edit/Unselect-all command. */
340 /****************************************************************************/
342 gl_ui_cmd_edit_unselect_all (GtkAction *action,
345 gl_debug (DEBUG_COMMANDS, "START");
347 g_return_if_fail (action && GTK_IS_ACTION(action));
348 g_return_if_fail (window && GL_IS_WINDOW(window));
350 gl_view_unselect_all (GL_VIEW(window->view));
352 gl_debug (DEBUG_COMMANDS, "END");
355 /****************************************************************************/
356 /** Edit/Preferences command. */
357 /****************************************************************************/
359 gl_ui_cmd_edit_preferences (GtkAction *action,
362 static GtkWidget *dialog = NULL;
364 gl_debug (DEBUG_COMMANDS, "START");
366 g_return_if_fail (action && GTK_IS_ACTION(action));
367 g_return_if_fail (window && GL_IS_WINDOW(window));
371 gtk_window_present (GTK_WINDOW (dialog));
372 gtk_window_set_transient_for (GTK_WINDOW (dialog),
377 dialog = gl_prefs_dialog_new (GTK_WINDOW(window));
379 g_signal_connect (G_OBJECT (dialog), "destroy",
380 G_CALLBACK (gtk_widget_destroyed), &dialog);
382 gtk_widget_show (dialog);
386 gl_debug (DEBUG_COMMANDS, "END");
389 /*****************************************************************************/
390 /** View/Property-bar-toggle command. */
391 /*****************************************************************************/
393 gl_ui_cmd_view_property_bar_toggle (GtkToggleAction *action,
398 gl_debug (DEBUG_COMMANDS, "START");
400 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
401 g_return_if_fail (window && GL_IS_WINDOW(window));
403 state = gtk_toggle_action_get_active (action);
405 gl_prefs->property_toolbar_visible = state;
407 gtk_widget_show (GTK_WIDGET (window->property_bar));
409 gtk_widget_hide (GTK_WIDGET (window->property_bar));
411 gl_prefs_model_save_settings (gl_prefs);
413 gl_debug (DEBUG_COMMANDS, "END");
416 /*****************************************************************************/
417 /** View/Property-bar-tooltips-toggle command. */
418 /*****************************************************************************/
420 gl_ui_cmd_view_property_bar_tips_toggle (GtkToggleAction *action,
425 gl_debug (DEBUG_COMMANDS, "START");
427 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
428 g_return_if_fail (window && GL_IS_WINDOW(window));
430 state = gtk_toggle_action_get_active (action);
432 gl_prefs->property_toolbar_view_tooltips = state;
433 gl_ui_property_bar_set_tooltips (window->property_bar, state);
434 gl_prefs_model_save_settings (gl_prefs);
436 gl_debug (DEBUG_COMMANDS, "END");
439 /*****************************************************************************/
440 /** View/Grid-toggle command. */
441 /*****************************************************************************/
443 gl_ui_cmd_view_grid_toggle (GtkToggleAction *action,
448 gl_debug (DEBUG_COMMANDS, "START");
450 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
451 g_return_if_fail (window && GL_IS_WINDOW(window));
453 state = gtk_toggle_action_get_active (action);
455 if (window->view != NULL)
458 gl_view_show_grid (GL_VIEW(window->view));
460 gl_view_hide_grid (GL_VIEW(window->view));
464 gl_prefs->grid_visible = state;
465 gl_prefs_model_save_settings (gl_prefs);
467 gl_debug (DEBUG_COMMANDS, "END");
470 /*****************************************************************************/
471 /** View/Markup-toggle command. */
472 /*****************************************************************************/
474 gl_ui_cmd_view_markup_toggle (GtkToggleAction *action,
479 gl_debug (DEBUG_COMMANDS, "START");
481 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
482 g_return_if_fail (window && GL_IS_WINDOW(window));
484 state = gtk_toggle_action_get_active (action);
486 if (window->view != NULL)
489 gl_view_show_markup (GL_VIEW(window->view));
491 gl_view_hide_markup (GL_VIEW(window->view));
495 gl_prefs->markup_visible = state;
496 gl_prefs_model_save_settings (gl_prefs);
498 gl_debug (DEBUG_COMMANDS, "END");
501 /*****************************************************************************/
502 /** View/Zoom-in command. */
503 /*****************************************************************************/
505 gl_ui_cmd_view_zoomin (GtkAction *action,
509 gl_debug (DEBUG_COMMANDS, "START");
511 g_return_if_fail (action && GTK_IS_ACTION(action));
512 g_return_if_fail (window && GL_IS_WINDOW(window));
514 if (window->view != NULL) {
515 gl_view_zoom_in (GL_VIEW(window->view));
518 gl_debug (DEBUG_COMMANDS, "END");
521 /*****************************************************************************/
522 /** View/Zoom-out command. */
523 /*****************************************************************************/
525 gl_ui_cmd_view_zoomout (GtkAction *action,
529 gl_debug (DEBUG_COMMANDS, "START");
531 g_return_if_fail (action && GTK_IS_ACTION(action));
532 g_return_if_fail (window && GL_IS_WINDOW(window));
534 if (window->view != NULL) {
535 gl_view_zoom_out (GL_VIEW(window->view));
538 gl_debug (DEBUG_COMMANDS, "END");
541 /*****************************************************************************/
542 /** View/Zoom-1:1 command. */
543 /*****************************************************************************/
545 gl_ui_cmd_view_zoom1to1 (GtkAction *action,
549 gl_debug (DEBUG_COMMANDS, "START");
551 g_return_if_fail (action && GTK_IS_ACTION(action));
552 g_return_if_fail (window && GL_IS_WINDOW(window));
554 if (window->view != NULL) {
555 gl_view_set_zoom (GL_VIEW(window->view), 1.0);
558 gl_debug (DEBUG_COMMANDS, "END");
561 /*****************************************************************************/
562 /** View/Zoom-to-fit command. */
563 /*****************************************************************************/
565 gl_ui_cmd_view_zoom_to_fit (GtkAction *action,
569 gl_debug (DEBUG_COMMANDS, "START");
571 g_return_if_fail (action && GTK_IS_ACTION(action));
572 g_return_if_fail (window && GL_IS_WINDOW(window));
574 if (window->view != NULL) {
575 gl_view_zoom_to_fit (GL_VIEW(window->view));
578 gl_debug (DEBUG_COMMANDS, "END");
581 /*****************************************************************************/
582 /** Objects/Arrow-mode command. */
583 /*****************************************************************************/
585 gl_ui_cmd_objects_arrow_mode (GtkAction *action,
588 gl_debug (DEBUG_COMMANDS, "START");
590 g_return_if_fail (action && GTK_IS_ACTION(action));
591 g_return_if_fail (window && GL_IS_WINDOW(window));
593 if (window->view != NULL) {
594 gl_view_arrow_mode (GL_VIEW(window->view));
597 gl_debug (DEBUG_COMMANDS, "END");
600 /*****************************************************************************/
601 /** Objects/Create-text object command. */
602 /*****************************************************************************/
604 gl_ui_cmd_objects_create_text (GtkAction *action,
608 gl_debug (DEBUG_COMMANDS, "START");
610 g_return_if_fail (action && GTK_IS_ACTION(action));
611 g_return_if_fail (window && GL_IS_WINDOW(window));
613 if (window->view != NULL) {
614 gl_view_object_create_mode (GL_VIEW(window->view),
615 GL_LABEL_OBJECT_TEXT);
618 gl_debug (DEBUG_COMMANDS, "END");
621 /*****************************************************************************/
622 /** Objects/Create-box object command. */
623 /*****************************************************************************/
625 gl_ui_cmd_objects_create_box (GtkAction *action,
629 gl_debug (DEBUG_COMMANDS, "START");
631 g_return_if_fail (action && GTK_IS_ACTION(action));
632 g_return_if_fail (window && GL_IS_WINDOW(window));
634 if (window->view != NULL) {
635 gl_view_object_create_mode (GL_VIEW(window->view),
636 GL_LABEL_OBJECT_BOX);
639 gl_debug (DEBUG_COMMANDS, "END");
642 /*****************************************************************************/
643 /** Objects/Create-line object command. */
644 /*****************************************************************************/
646 gl_ui_cmd_objects_create_line (GtkAction *action,
650 gl_debug (DEBUG_COMMANDS, "START");
652 g_return_if_fail (action && GTK_IS_ACTION(action));
653 g_return_if_fail (window && GL_IS_WINDOW(window));
655 if (window->view != NULL) {
656 gl_view_object_create_mode (GL_VIEW(window->view),
657 GL_LABEL_OBJECT_LINE);
660 gl_debug (DEBUG_COMMANDS, "END");
663 /*****************************************************************************/
664 /** Objects/Create-ellipse object command. */
665 /*****************************************************************************/
667 gl_ui_cmd_objects_create_ellipse (GtkAction *action,
671 gl_debug (DEBUG_COMMANDS, "START");
673 g_return_if_fail (action && GTK_IS_ACTION(action));
674 g_return_if_fail (window && GL_IS_WINDOW(window));
676 if (window->view != NULL) {
677 gl_view_object_create_mode (GL_VIEW(window->view),
678 GL_LABEL_OBJECT_ELLIPSE);
681 gl_debug (DEBUG_COMMANDS, "END");
684 /*****************************************************************************/
685 /** Objects/Create-image object command. */
686 /*****************************************************************************/
688 gl_ui_cmd_objects_create_image (GtkAction *action,
692 gl_debug (DEBUG_COMMANDS, "START");
694 g_return_if_fail (action && GTK_IS_ACTION(action));
695 g_return_if_fail (window && GL_IS_WINDOW(window));
697 if (window->view != NULL) {
698 gl_view_object_create_mode (GL_VIEW(window->view),
699 GL_LABEL_OBJECT_IMAGE);
702 gl_debug (DEBUG_COMMANDS, "END");
705 /*****************************************************************************/
706 /** Objects/Create-barcode object command. */
707 /*****************************************************************************/
709 gl_ui_cmd_objects_create_barcode (GtkAction *action,
713 gl_debug (DEBUG_COMMANDS, "START");
715 g_return_if_fail (action && GTK_IS_ACTION(action));
716 g_return_if_fail (window && GL_IS_WINDOW(window));
718 if (window->view != NULL) {
719 gl_view_object_create_mode (GL_VIEW(window->view),
720 GL_LABEL_OBJECT_BARCODE);
723 gl_debug (DEBUG_COMMANDS, "END");
726 /*****************************************************************************/
727 /** Objects/Raise command. */
728 /*****************************************************************************/
730 gl_ui_cmd_objects_raise (GtkAction *action,
734 gl_debug (DEBUG_COMMANDS, "START");
736 g_return_if_fail (action && GTK_IS_ACTION(action));
737 g_return_if_fail (window && GL_IS_WINDOW(window));
739 if (window->view != NULL) {
740 gl_view_raise_selection (GL_VIEW(window->view));
743 gl_debug (DEBUG_COMMANDS, "END");
746 /*****************************************************************************/
747 /** Objects/Lower command. */
748 /*****************************************************************************/
750 gl_ui_cmd_objects_lower (GtkAction *action,
754 gl_debug (DEBUG_COMMANDS, "START");
756 g_return_if_fail (action && GTK_IS_ACTION(action));
757 g_return_if_fail (window && GL_IS_WINDOW(window));
759 if (window->view != NULL) {
760 gl_view_lower_selection (GL_VIEW(window->view));
763 gl_debug (DEBUG_COMMANDS, "END");
766 /*****************************************************************************/
767 /** Objects/Rotate-left-90-degrees command. */
768 /*****************************************************************************/
770 gl_ui_cmd_objects_rotate_left (GtkAction *action,
774 gl_debug (DEBUG_COMMANDS, "START");
776 g_return_if_fail (action && GTK_IS_ACTION(action));
777 g_return_if_fail (window && GL_IS_WINDOW(window));
779 if (window->view != NULL) {
780 gl_view_rotate_selection_left (GL_VIEW(window->view));
783 gl_debug (DEBUG_COMMANDS, "END");
786 /*****************************************************************************/
787 /** Objects/Rotate-right-90-degrees command. */
788 /*****************************************************************************/
790 gl_ui_cmd_objects_rotate_right (GtkAction *action,
794 gl_debug (DEBUG_COMMANDS, "START");
796 g_return_if_fail (action && GTK_IS_ACTION(action));
797 g_return_if_fail (window && GL_IS_WINDOW(window));
799 if (window->view != NULL) {
800 gl_view_rotate_selection_right (GL_VIEW(window->view));
803 gl_debug (DEBUG_COMMANDS, "END");
806 /*****************************************************************************/
807 /** Objects/Flip-horizontally command. */
808 /*****************************************************************************/
810 gl_ui_cmd_objects_flip_horiz (GtkAction *action,
814 gl_debug (DEBUG_COMMANDS, "START");
816 g_return_if_fail (action && GTK_IS_ACTION(action));
817 g_return_if_fail (window && GL_IS_WINDOW(window));
819 if (window->view != NULL) {
820 gl_view_flip_selection_horiz (GL_VIEW(window->view));
823 gl_debug (DEBUG_COMMANDS, "END");
826 /*****************************************************************************/
827 /** Objects/Flip-vertically command. */
828 /*****************************************************************************/
830 gl_ui_cmd_objects_flip_vert (GtkAction *action,
834 gl_debug (DEBUG_COMMANDS, "START");
836 g_return_if_fail (action && GTK_IS_ACTION(action));
837 g_return_if_fail (window && GL_IS_WINDOW(window));
839 if (window->view != NULL) {
840 gl_view_flip_selection_vert (GL_VIEW(window->view));
843 gl_debug (DEBUG_COMMANDS, "END");
846 /*****************************************************************************/
847 /** Objects/Align-left command. */
848 /*****************************************************************************/
850 gl_ui_cmd_objects_align_left (GtkAction *action,
854 gl_debug (DEBUG_COMMANDS, "START");
856 g_return_if_fail (action && GTK_IS_ACTION(action));
857 g_return_if_fail (window && GL_IS_WINDOW(window));
859 if (window->view != NULL) {
860 gl_view_align_selection_left (GL_VIEW(window->view));
863 gl_debug (DEBUG_COMMANDS, "END");
866 /*****************************************************************************/
867 /** Objects/Align-right command. */
868 /*****************************************************************************/
870 gl_ui_cmd_objects_align_right (GtkAction *action,
874 gl_debug (DEBUG_COMMANDS, "START");
876 g_return_if_fail (action && GTK_IS_ACTION(action));
877 g_return_if_fail (window && GL_IS_WINDOW(window));
879 if (window->view != NULL) {
880 gl_view_align_selection_right (GL_VIEW(window->view));
883 gl_debug (DEBUG_COMMANDS, "END");
886 /*****************************************************************************/
887 /** Objects/Align-horizontal-center command. */
888 /*****************************************************************************/
890 gl_ui_cmd_objects_align_hcenter (GtkAction *action,
894 gl_debug (DEBUG_COMMANDS, "START");
896 g_return_if_fail (action && GTK_IS_ACTION(action));
897 g_return_if_fail (window && GL_IS_WINDOW(window));
899 if (window->view != NULL) {
900 gl_view_align_selection_hcenter (GL_VIEW(window->view));
903 gl_debug (DEBUG_COMMANDS, "END");
906 /*****************************************************************************/
907 /** Objects/Align-top command. */
908 /*****************************************************************************/
910 gl_ui_cmd_objects_align_top (GtkAction *action,
914 gl_debug (DEBUG_COMMANDS, "START");
916 g_return_if_fail (action && GTK_IS_ACTION(action));
917 g_return_if_fail (window && GL_IS_WINDOW(window));
919 if (window->view != NULL) {
920 gl_view_align_selection_top (GL_VIEW(window->view));
923 gl_debug (DEBUG_COMMANDS, "END");
926 /*****************************************************************************/
927 /** Objects/Align-bottom command. */
928 /*****************************************************************************/
930 gl_ui_cmd_objects_align_bottom (GtkAction *action,
934 gl_debug (DEBUG_COMMANDS, "START");
936 g_return_if_fail (action && GTK_IS_ACTION(action));
937 g_return_if_fail (window && GL_IS_WINDOW(window));
939 if (window->view != NULL) {
940 gl_view_align_selection_bottom (GL_VIEW(window->view));
943 gl_debug (DEBUG_COMMANDS, "END");
946 /*****************************************************************************/
947 /** Objects/Align-vertical center command. */
948 /*****************************************************************************/
950 gl_ui_cmd_objects_align_vcenter (GtkAction *action,
954 gl_debug (DEBUG_COMMANDS, "START");
956 g_return_if_fail (action && GTK_IS_ACTION(action));
957 g_return_if_fail (window && GL_IS_WINDOW(window));
959 if (window->view != NULL) {
960 gl_view_align_selection_vcenter (GL_VIEW(window->view));
963 gl_debug (DEBUG_COMMANDS, "END");
966 /*****************************************************************************/
967 /** Objects/Center-horizontally command. */
968 /*****************************************************************************/
970 gl_ui_cmd_objects_center_horiz (GtkAction *action,
974 gl_debug (DEBUG_COMMANDS, "START");
976 g_return_if_fail (action && GTK_IS_ACTION(action));
977 g_return_if_fail (window && GL_IS_WINDOW(window));
979 if (window->view != NULL) {
980 gl_view_center_selection_horiz (GL_VIEW(window->view));
983 gl_debug (DEBUG_COMMANDS, "END");
986 /*****************************************************************************/
987 /** Objects/Center-vertically command. */
988 /*****************************************************************************/
990 gl_ui_cmd_objects_center_vert (GtkAction *action,
994 gl_debug (DEBUG_COMMANDS, "START");
996 g_return_if_fail (action && GTK_IS_ACTION(action));
997 g_return_if_fail (window && GL_IS_WINDOW(window));
999 if (window->view != NULL) {
1000 gl_view_center_selection_vert (GL_VIEW(window->view));
1003 gl_debug (DEBUG_COMMANDS, "END");
1006 /*****************************************************************************/
1007 /** Objects/Edit- merge-properties command. */
1008 /*****************************************************************************/
1010 gl_ui_cmd_objects_merge_properties (GtkAction *action,
1014 gl_debug (DEBUG_COMMANDS, "START");
1016 g_return_if_fail (action && GTK_IS_ACTION(action));
1017 g_return_if_fail (window && GL_IS_WINDOW(window));
1019 if (window->merge_dialog) {
1021 gtk_window_present (GTK_WINDOW(window->merge_dialog));
1022 gtk_window_set_transient_for (GTK_WINDOW (window->merge_dialog),
1023 GTK_WINDOW (window));
1027 window->merge_dialog =
1029 gl_merge_properties_dialog_new (GL_VIEW(window->view)->label,
1030 GTK_WINDOW(window)) );
1032 g_signal_connect (G_OBJECT(window->merge_dialog), "destroy",
1033 G_CALLBACK (gtk_widget_destroyed),
1034 &window->merge_dialog);
1036 gtk_widget_show (GTK_WIDGET (window->merge_dialog));
1040 gl_debug (DEBUG_COMMANDS, "END");
1043 /****************************************************************************/
1044 /** Help/Contents command. */
1045 /****************************************************************************/
1047 gl_ui_cmd_help_contents (GtkAction *action,
1050 GError *error = NULL;
1052 gl_debug (DEBUG_COMMANDS, "START");
1054 g_return_if_fail (action && GTK_IS_ACTION(action));
1055 g_return_if_fail (window && GL_IS_WINDOW(window));
1057 gnome_help_display_with_doc_id (NULL, NULL, "glabels.xml", NULL, &error);
1061 g_message ("%s", error->message);
1063 g_error_free (error);
1066 gl_debug (DEBUG_COMMANDS, "END");
1070 /****************************************************************************/
1071 /** Help/About command. */
1072 /****************************************************************************/
1074 gl_ui_cmd_help_about (GtkAction *action,
1077 static GtkWidget *about = NULL;
1079 GdkPixbuf *pixbuf = NULL;
1081 const gchar *authors[] = {
1084 _("Glabels includes contributions from:"),
1090 _("See the file AUTHORS for additional credits,"),
1091 _("or visit http://glabels.sourceforge.net/"),
1095 const gchar *artists[] = {
1101 const gchar *copy_text = "Copyright \xc2\xa9 2001-2009 Jim Evins";
1103 const gchar *about_text = _("A label and business card creation program.\n");
1105 const gchar *url = "http://glabels.sourceforge.net";
1107 const gchar *translator_credits = _("translator-credits");
1109 const gchar *license = _(
1110 "Glabels is free software; you can redistribute it and/or modify it\n"
1111 "under the terms of the GNU General Public License as published by\n"
1112 "the Free Software Foundation; either version 2 of the License, or\n"
1113 "(at your option) any later version.\n" "\n"
1114 "This program is distributed in the hope that it will be useful, but\n"
1115 "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
1116 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\n"
1117 "the GNU General Public License for more details.\n");
1119 gl_debug (DEBUG_COMMANDS, "START");
1121 g_return_if_fail (action && GTK_IS_ACTION(action));
1122 g_return_if_fail (window && GL_IS_WINDOW(window));
1127 gtk_window_present (GTK_WINDOW (about));
1128 gtk_window_set_transient_for (GTK_WINDOW (about),
1129 GTK_WINDOW (window));
1133 pixbuf = gdk_pixbuf_new_from_file (GLABELS_PIXMAP_DIR "glabels-splash.png", NULL);
1135 about = gtk_about_dialog_new ();
1136 gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about), _("glabels"));
1137 gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about), VERSION);
1138 gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about), copy_text);
1139 gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG(about), about_text);
1140 gtk_about_dialog_set_website (GTK_ABOUT_DIALOG(about), url);
1141 gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about), pixbuf);
1143 gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG(about), authors);
1144 gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG(about), artists);
1145 gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about),
1146 translator_credits);
1147 gtk_about_dialog_set_license (GTK_ABOUT_DIALOG(about), license);
1149 gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);
1151 g_signal_connect (G_OBJECT (about), "response",
1152 G_CALLBACK (gtk_widget_destroy), NULL);
1153 g_signal_connect (G_OBJECT (about), "destroy",
1154 G_CALLBACK (gtk_widget_destroyed), &about);
1156 gtk_window_set_transient_for (GTK_WINDOW (about),
1157 GTK_WINDOW (window));
1159 gtk_window_present (GTK_WINDOW (about));
1162 g_object_unref (pixbuf);
1166 gl_debug (DEBUG_COMMANDS, "END");