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-2009 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>
34 #include "template-designer.h"
37 #include "prefs-dialog.h"
43 /****************************************************************************/
44 /** File/New command. */
45 /****************************************************************************/
47 gl_ui_cmd_file_new (GtkAction *action,
50 gl_debug (DEBUG_COMMANDS, "START");
52 g_return_if_fail (action && GTK_IS_ACTION(action));
53 g_return_if_fail (window && GL_IS_WINDOW(window));
57 gl_debug (DEBUG_COMMANDS, "END");
60 /****************************************************************************/
61 /** File/Properties command. */
62 /****************************************************************************/
64 gl_ui_cmd_file_properties (GtkAction *action,
67 gl_debug (DEBUG_COMMANDS, "START");
69 g_return_if_fail (action && GTK_IS_ACTION(action));
70 g_return_if_fail (window && GL_IS_WINDOW(window));
72 gl_file_properties (GL_VIEW(window->view)->label, window);
74 gl_debug (DEBUG_COMMANDS, "END");
77 /****************************************************************************/
78 /** File/Template-Designer command. */
79 /****************************************************************************/
81 gl_ui_cmd_file_template_designer (GtkAction *action,
86 gl_debug (DEBUG_COMMANDS, "START");
88 g_return_if_fail (action && GTK_IS_ACTION(action));
89 g_return_if_fail (window && GL_IS_WINDOW(window));
91 dialog = gl_template_designer_new (GTK_WINDOW(window));
93 gtk_widget_show (dialog);
95 gl_debug (DEBUG_COMMANDS, "END");
98 /****************************************************************************/
99 /** File/Open command. */
100 /****************************************************************************/
102 gl_ui_cmd_file_open (GtkAction *action,
105 gl_debug (DEBUG_COMMANDS, "START");
107 g_return_if_fail (action && GTK_IS_ACTION(action));
108 g_return_if_fail (window && GL_IS_WINDOW(window));
110 gl_file_open (window);
112 gl_debug (DEBUG_COMMANDS, "END");
115 /****************************************************************************/
116 /** File/Open-Recent command. */
117 /****************************************************************************/
119 gl_ui_cmd_file_open_recent (GtkRecentChooser *chooser,
123 gchar *utf8_filename;
125 gl_debug (DEBUG_COMMANDS, "START");
127 g_return_if_fail (chooser && GTK_IS_RECENT_CHOOSER(chooser));
128 g_return_if_fail (window && GL_IS_WINDOW(window));
130 item = gtk_recent_chooser_get_current_item (chooser);
134 utf8_filename = gl_recent_get_utf8_filename (item);
136 gl_debug (DEBUG_COMMANDS, "Selected %s\n", utf8_filename);
137 gl_file_open_recent (utf8_filename, window);
139 gtk_recent_info_unref (item);
141 gl_debug (DEBUG_COMMANDS, "END");
144 /****************************************************************************/
145 /** File/Save command. */
146 /****************************************************************************/
148 gl_ui_cmd_file_save (GtkAction *action,
151 gl_debug (DEBUG_COMMANDS, "START");
153 g_return_if_fail (action && GTK_IS_ACTION(action));
154 g_return_if_fail (window && GL_IS_WINDOW(window));
156 gl_file_save (GL_VIEW(window->view)->label, window);
158 gl_debug (DEBUG_COMMANDS, "END");
161 /****************************************************************************/
162 /** File/Save-as command. */
163 /****************************************************************************/
165 gl_ui_cmd_file_save_as (GtkAction *action,
168 gl_debug (DEBUG_COMMANDS, "START");
170 g_return_if_fail (action && GTK_IS_ACTION(action));
171 g_return_if_fail (window && GL_IS_WINDOW(window));
173 gl_file_save_as (GL_VIEW(window->view)->label, window);
175 gl_debug (DEBUG_COMMANDS, "END");
178 /****************************************************************************/
179 /** File/Print command. */
180 /****************************************************************************/
182 gl_ui_cmd_file_print (GtkAction *action,
186 GtkPrintOperationResult result;
188 gl_debug (DEBUG_COMMANDS, "START");
190 g_return_if_fail (action && GTK_IS_ACTION(action));
191 g_return_if_fail (window && GL_IS_WINDOW(window));
193 op = gl_print_op_new (GL_VIEW(window->view)->label);
195 if (window->print_settings)
197 gl_print_op_set_settings (op, window->print_settings);
200 result = gtk_print_operation_run (GTK_PRINT_OPERATION (op),
201 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
205 if ( result == GTK_PRINT_OPERATION_RESULT_APPLY )
207 gl_print_op_free_settings (window->print_settings);
208 window->print_settings = gl_print_op_get_settings (op);
211 gl_debug (DEBUG_COMMANDS, "END");
214 /****************************************************************************/
215 /** File/Close command. */
216 /****************************************************************************/
218 gl_ui_cmd_file_close (GtkAction *action,
221 gl_debug (DEBUG_COMMANDS, "START");
223 g_return_if_fail (action && GTK_IS_ACTION(action));
224 g_return_if_fail (window && GL_IS_WINDOW(window));
226 gl_file_close (window);
228 gl_debug (DEBUG_COMMANDS, "END");
231 /****************************************************************************/
232 /** File/Quit command. */
233 /****************************************************************************/
235 gl_ui_cmd_file_quit (GtkAction *action,
238 gl_debug (DEBUG_COMMANDS, "START");
240 g_return_if_fail (action && GTK_IS_ACTION(action));
241 g_return_if_fail (window && GL_IS_WINDOW(window));
245 gl_debug (DEBUG_COMMANDS, "END");
249 /****************************************************************************/
250 /** Edit/Cut command. */
251 /****************************************************************************/
253 gl_ui_cmd_edit_cut (GtkAction *action,
256 gl_debug (DEBUG_COMMANDS, "START");
258 g_return_if_fail (action && GTK_IS_ACTION(action));
259 g_return_if_fail (window && GL_IS_WINDOW(window));
261 gl_view_cut (GL_VIEW(window->view));
263 gl_debug (DEBUG_COMMANDS, "END");
266 /****************************************************************************/
267 /** Edit/Copy command. */
268 /****************************************************************************/
270 gl_ui_cmd_edit_copy (GtkAction *action,
273 gl_debug (DEBUG_COMMANDS, "START");
275 g_return_if_fail (action && GTK_IS_ACTION(action));
276 g_return_if_fail (window && GL_IS_WINDOW(window));
278 gl_view_copy (GL_VIEW(window->view));
280 gl_debug (DEBUG_COMMANDS, "END");
283 /****************************************************************************/
284 /** Edit/Paste command. */
285 /****************************************************************************/
287 gl_ui_cmd_edit_paste (GtkAction *action,
290 gl_debug (DEBUG_COMMANDS, "START");
292 g_return_if_fail (action && GTK_IS_ACTION(action));
293 g_return_if_fail (window && GL_IS_WINDOW(window));
295 gl_view_paste (GL_VIEW(window->view));
297 gl_debug (DEBUG_COMMANDS, "END");
301 /****************************************************************************/
302 /** Edit/Delete command. */
303 /****************************************************************************/
305 gl_ui_cmd_edit_delete (GtkAction *action,
308 gl_debug (DEBUG_COMMANDS, "START");
310 g_return_if_fail (action && GTK_IS_ACTION(action));
311 g_return_if_fail (window && GL_IS_WINDOW(window));
313 gl_view_delete_selection (GL_VIEW(window->view));
315 gl_debug (DEBUG_COMMANDS, "END");
319 /****************************************************************************/
320 /** Edit/Select-all command. */
321 /****************************************************************************/
323 gl_ui_cmd_edit_select_all (GtkAction *action,
326 gl_debug (DEBUG_COMMANDS, "START");
328 g_return_if_fail (action && GTK_IS_ACTION(action));
329 g_return_if_fail (window && GL_IS_WINDOW(window));
331 gl_view_select_all (GL_VIEW(window->view));
333 gl_debug (DEBUG_COMMANDS, "END");
336 /****************************************************************************/
337 /** Edit/Unselect-all command. */
338 /****************************************************************************/
340 gl_ui_cmd_edit_unselect_all (GtkAction *action,
343 gl_debug (DEBUG_COMMANDS, "START");
345 g_return_if_fail (action && GTK_IS_ACTION(action));
346 g_return_if_fail (window && GL_IS_WINDOW(window));
348 gl_view_unselect_all (GL_VIEW(window->view));
350 gl_debug (DEBUG_COMMANDS, "END");
353 /****************************************************************************/
354 /** Edit/Preferences command. */
355 /****************************************************************************/
357 gl_ui_cmd_edit_preferences (GtkAction *action,
360 static GtkWidget *dialog = NULL;
362 gl_debug (DEBUG_COMMANDS, "START");
364 g_return_if_fail (action && GTK_IS_ACTION(action));
365 g_return_if_fail (window && GL_IS_WINDOW(window));
369 gtk_window_present (GTK_WINDOW (dialog));
370 gtk_window_set_transient_for (GTK_WINDOW (dialog),
375 dialog = gl_prefs_dialog_new (GTK_WINDOW(window));
377 g_signal_connect (G_OBJECT (dialog), "destroy",
378 G_CALLBACK (gtk_widget_destroyed), &dialog);
380 gtk_widget_show (dialog);
384 gl_debug (DEBUG_COMMANDS, "END");
387 /*****************************************************************************/
388 /** View/Property-bar-toggle command. */
389 /*****************************************************************************/
391 gl_ui_cmd_view_property_bar_toggle (GtkToggleAction *action,
396 gl_debug (DEBUG_COMMANDS, "START");
398 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
399 g_return_if_fail (window && GL_IS_WINDOW(window));
401 state = gtk_toggle_action_get_active (action);
403 gl_prefs->property_toolbar_visible = state;
405 gtk_widget_show (GTK_WIDGET (window->property_bar));
407 gtk_widget_hide (GTK_WIDGET (window->property_bar));
409 gl_prefs_model_save_settings (gl_prefs);
411 gl_debug (DEBUG_COMMANDS, "END");
415 /*****************************************************************************/
416 /** View/Grid-toggle command. */
417 /*****************************************************************************/
419 gl_ui_cmd_view_grid_toggle (GtkToggleAction *action,
424 gl_debug (DEBUG_COMMANDS, "START");
426 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
427 g_return_if_fail (window && GL_IS_WINDOW(window));
429 state = gtk_toggle_action_get_active (action);
431 if (window->view != NULL)
434 gl_view_show_grid (GL_VIEW(window->view));
436 gl_view_hide_grid (GL_VIEW(window->view));
440 gl_prefs->grid_visible = state;
441 gl_prefs_model_save_settings (gl_prefs);
443 gl_debug (DEBUG_COMMANDS, "END");
446 /*****************************************************************************/
447 /** View/Markup-toggle command. */
448 /*****************************************************************************/
450 gl_ui_cmd_view_markup_toggle (GtkToggleAction *action,
455 gl_debug (DEBUG_COMMANDS, "START");
457 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
458 g_return_if_fail (window && GL_IS_WINDOW(window));
460 state = gtk_toggle_action_get_active (action);
462 if (window->view != NULL)
465 gl_view_show_markup (GL_VIEW(window->view));
467 gl_view_hide_markup (GL_VIEW(window->view));
471 gl_prefs->markup_visible = state;
472 gl_prefs_model_save_settings (gl_prefs);
474 gl_debug (DEBUG_COMMANDS, "END");
477 /*****************************************************************************/
478 /** View/Zoom-in command. */
479 /*****************************************************************************/
481 gl_ui_cmd_view_zoomin (GtkAction *action,
485 gl_debug (DEBUG_COMMANDS, "START");
487 g_return_if_fail (action && GTK_IS_ACTION(action));
488 g_return_if_fail (window && GL_IS_WINDOW(window));
490 if (window->view != NULL) {
491 gl_view_zoom_in (GL_VIEW(window->view));
494 gl_debug (DEBUG_COMMANDS, "END");
497 /*****************************************************************************/
498 /** View/Zoom-out command. */
499 /*****************************************************************************/
501 gl_ui_cmd_view_zoomout (GtkAction *action,
505 gl_debug (DEBUG_COMMANDS, "START");
507 g_return_if_fail (action && GTK_IS_ACTION(action));
508 g_return_if_fail (window && GL_IS_WINDOW(window));
510 if (window->view != NULL) {
511 gl_view_zoom_out (GL_VIEW(window->view));
514 gl_debug (DEBUG_COMMANDS, "END");
517 /*****************************************************************************/
518 /** View/Zoom-1:1 command. */
519 /*****************************************************************************/
521 gl_ui_cmd_view_zoom1to1 (GtkAction *action,
525 gl_debug (DEBUG_COMMANDS, "START");
527 g_return_if_fail (action && GTK_IS_ACTION(action));
528 g_return_if_fail (window && GL_IS_WINDOW(window));
530 if (window->view != NULL) {
531 gl_view_set_zoom (GL_VIEW(window->view), 1.0);
534 gl_debug (DEBUG_COMMANDS, "END");
537 /*****************************************************************************/
538 /** View/Zoom-to-fit command. */
539 /*****************************************************************************/
541 gl_ui_cmd_view_zoom_to_fit (GtkAction *action,
545 gl_debug (DEBUG_COMMANDS, "START");
547 g_return_if_fail (action && GTK_IS_ACTION(action));
548 g_return_if_fail (window && GL_IS_WINDOW(window));
550 if (window->view != NULL) {
551 gl_view_zoom_to_fit (GL_VIEW(window->view));
554 gl_debug (DEBUG_COMMANDS, "END");
557 /*****************************************************************************/
558 /** Objects/Arrow-mode command. */
559 /*****************************************************************************/
561 gl_ui_cmd_objects_arrow_mode (GtkAction *action,
564 gl_debug (DEBUG_COMMANDS, "START");
566 g_return_if_fail (action && GTK_IS_ACTION(action));
567 g_return_if_fail (window && GL_IS_WINDOW(window));
569 if (window->view != NULL) {
570 gl_view_arrow_mode (GL_VIEW(window->view));
573 gl_debug (DEBUG_COMMANDS, "END");
576 /*****************************************************************************/
577 /** Objects/Create-text object command. */
578 /*****************************************************************************/
580 gl_ui_cmd_objects_create_text (GtkAction *action,
584 gl_debug (DEBUG_COMMANDS, "START");
586 g_return_if_fail (action && GTK_IS_ACTION(action));
587 g_return_if_fail (window && GL_IS_WINDOW(window));
589 if (window->view != NULL) {
590 gl_view_object_create_mode (GL_VIEW(window->view),
591 GL_LABEL_OBJECT_TEXT);
594 gl_debug (DEBUG_COMMANDS, "END");
597 /*****************************************************************************/
598 /** Objects/Create-box object command. */
599 /*****************************************************************************/
601 gl_ui_cmd_objects_create_box (GtkAction *action,
605 gl_debug (DEBUG_COMMANDS, "START");
607 g_return_if_fail (action && GTK_IS_ACTION(action));
608 g_return_if_fail (window && GL_IS_WINDOW(window));
610 if (window->view != NULL) {
611 gl_view_object_create_mode (GL_VIEW(window->view),
612 GL_LABEL_OBJECT_BOX);
615 gl_debug (DEBUG_COMMANDS, "END");
618 /*****************************************************************************/
619 /** Objects/Create-line object command. */
620 /*****************************************************************************/
622 gl_ui_cmd_objects_create_line (GtkAction *action,
626 gl_debug (DEBUG_COMMANDS, "START");
628 g_return_if_fail (action && GTK_IS_ACTION(action));
629 g_return_if_fail (window && GL_IS_WINDOW(window));
631 if (window->view != NULL) {
632 gl_view_object_create_mode (GL_VIEW(window->view),
633 GL_LABEL_OBJECT_LINE);
636 gl_debug (DEBUG_COMMANDS, "END");
639 /*****************************************************************************/
640 /** Objects/Create-ellipse object command. */
641 /*****************************************************************************/
643 gl_ui_cmd_objects_create_ellipse (GtkAction *action,
647 gl_debug (DEBUG_COMMANDS, "START");
649 g_return_if_fail (action && GTK_IS_ACTION(action));
650 g_return_if_fail (window && GL_IS_WINDOW(window));
652 if (window->view != NULL) {
653 gl_view_object_create_mode (GL_VIEW(window->view),
654 GL_LABEL_OBJECT_ELLIPSE);
657 gl_debug (DEBUG_COMMANDS, "END");
660 /*****************************************************************************/
661 /** Objects/Create-image object command. */
662 /*****************************************************************************/
664 gl_ui_cmd_objects_create_image (GtkAction *action,
668 gl_debug (DEBUG_COMMANDS, "START");
670 g_return_if_fail (action && GTK_IS_ACTION(action));
671 g_return_if_fail (window && GL_IS_WINDOW(window));
673 if (window->view != NULL) {
674 gl_view_object_create_mode (GL_VIEW(window->view),
675 GL_LABEL_OBJECT_IMAGE);
678 gl_debug (DEBUG_COMMANDS, "END");
681 /*****************************************************************************/
682 /** Objects/Create-barcode object command. */
683 /*****************************************************************************/
685 gl_ui_cmd_objects_create_barcode (GtkAction *action,
689 gl_debug (DEBUG_COMMANDS, "START");
691 g_return_if_fail (action && GTK_IS_ACTION(action));
692 g_return_if_fail (window && GL_IS_WINDOW(window));
694 if (window->view != NULL) {
695 gl_view_object_create_mode (GL_VIEW(window->view),
696 GL_LABEL_OBJECT_BARCODE);
699 gl_debug (DEBUG_COMMANDS, "END");
702 /*****************************************************************************/
703 /** Objects/Raise command. */
704 /*****************************************************************************/
706 gl_ui_cmd_objects_raise (GtkAction *action,
710 gl_debug (DEBUG_COMMANDS, "START");
712 g_return_if_fail (action && GTK_IS_ACTION(action));
713 g_return_if_fail (window && GL_IS_WINDOW(window));
715 if (window->view != NULL) {
716 gl_view_raise_selection (GL_VIEW(window->view));
719 gl_debug (DEBUG_COMMANDS, "END");
722 /*****************************************************************************/
723 /** Objects/Lower command. */
724 /*****************************************************************************/
726 gl_ui_cmd_objects_lower (GtkAction *action,
730 gl_debug (DEBUG_COMMANDS, "START");
732 g_return_if_fail (action && GTK_IS_ACTION(action));
733 g_return_if_fail (window && GL_IS_WINDOW(window));
735 if (window->view != NULL) {
736 gl_view_lower_selection (GL_VIEW(window->view));
739 gl_debug (DEBUG_COMMANDS, "END");
742 /*****************************************************************************/
743 /** Objects/Rotate-left-90-degrees command. */
744 /*****************************************************************************/
746 gl_ui_cmd_objects_rotate_left (GtkAction *action,
750 gl_debug (DEBUG_COMMANDS, "START");
752 g_return_if_fail (action && GTK_IS_ACTION(action));
753 g_return_if_fail (window && GL_IS_WINDOW(window));
755 if (window->view != NULL) {
756 gl_view_rotate_selection_left (GL_VIEW(window->view));
759 gl_debug (DEBUG_COMMANDS, "END");
762 /*****************************************************************************/
763 /** Objects/Rotate-right-90-degrees command. */
764 /*****************************************************************************/
766 gl_ui_cmd_objects_rotate_right (GtkAction *action,
770 gl_debug (DEBUG_COMMANDS, "START");
772 g_return_if_fail (action && GTK_IS_ACTION(action));
773 g_return_if_fail (window && GL_IS_WINDOW(window));
775 if (window->view != NULL) {
776 gl_view_rotate_selection_right (GL_VIEW(window->view));
779 gl_debug (DEBUG_COMMANDS, "END");
782 /*****************************************************************************/
783 /** Objects/Flip-horizontally command. */
784 /*****************************************************************************/
786 gl_ui_cmd_objects_flip_horiz (GtkAction *action,
790 gl_debug (DEBUG_COMMANDS, "START");
792 g_return_if_fail (action && GTK_IS_ACTION(action));
793 g_return_if_fail (window && GL_IS_WINDOW(window));
795 if (window->view != NULL) {
796 gl_view_flip_selection_horiz (GL_VIEW(window->view));
799 gl_debug (DEBUG_COMMANDS, "END");
802 /*****************************************************************************/
803 /** Objects/Flip-vertically command. */
804 /*****************************************************************************/
806 gl_ui_cmd_objects_flip_vert (GtkAction *action,
810 gl_debug (DEBUG_COMMANDS, "START");
812 g_return_if_fail (action && GTK_IS_ACTION(action));
813 g_return_if_fail (window && GL_IS_WINDOW(window));
815 if (window->view != NULL) {
816 gl_view_flip_selection_vert (GL_VIEW(window->view));
819 gl_debug (DEBUG_COMMANDS, "END");
822 /*****************************************************************************/
823 /** Objects/Align-left command. */
824 /*****************************************************************************/
826 gl_ui_cmd_objects_align_left (GtkAction *action,
830 gl_debug (DEBUG_COMMANDS, "START");
832 g_return_if_fail (action && GTK_IS_ACTION(action));
833 g_return_if_fail (window && GL_IS_WINDOW(window));
835 if (window->view != NULL) {
836 gl_view_align_selection_left (GL_VIEW(window->view));
839 gl_debug (DEBUG_COMMANDS, "END");
842 /*****************************************************************************/
843 /** Objects/Align-right command. */
844 /*****************************************************************************/
846 gl_ui_cmd_objects_align_right (GtkAction *action,
850 gl_debug (DEBUG_COMMANDS, "START");
852 g_return_if_fail (action && GTK_IS_ACTION(action));
853 g_return_if_fail (window && GL_IS_WINDOW(window));
855 if (window->view != NULL) {
856 gl_view_align_selection_right (GL_VIEW(window->view));
859 gl_debug (DEBUG_COMMANDS, "END");
862 /*****************************************************************************/
863 /** Objects/Align-horizontal-center command. */
864 /*****************************************************************************/
866 gl_ui_cmd_objects_align_hcenter (GtkAction *action,
870 gl_debug (DEBUG_COMMANDS, "START");
872 g_return_if_fail (action && GTK_IS_ACTION(action));
873 g_return_if_fail (window && GL_IS_WINDOW(window));
875 if (window->view != NULL) {
876 gl_view_align_selection_hcenter (GL_VIEW(window->view));
879 gl_debug (DEBUG_COMMANDS, "END");
882 /*****************************************************************************/
883 /** Objects/Align-top command. */
884 /*****************************************************************************/
886 gl_ui_cmd_objects_align_top (GtkAction *action,
890 gl_debug (DEBUG_COMMANDS, "START");
892 g_return_if_fail (action && GTK_IS_ACTION(action));
893 g_return_if_fail (window && GL_IS_WINDOW(window));
895 if (window->view != NULL) {
896 gl_view_align_selection_top (GL_VIEW(window->view));
899 gl_debug (DEBUG_COMMANDS, "END");
902 /*****************************************************************************/
903 /** Objects/Align-bottom command. */
904 /*****************************************************************************/
906 gl_ui_cmd_objects_align_bottom (GtkAction *action,
910 gl_debug (DEBUG_COMMANDS, "START");
912 g_return_if_fail (action && GTK_IS_ACTION(action));
913 g_return_if_fail (window && GL_IS_WINDOW(window));
915 if (window->view != NULL) {
916 gl_view_align_selection_bottom (GL_VIEW(window->view));
919 gl_debug (DEBUG_COMMANDS, "END");
922 /*****************************************************************************/
923 /** Objects/Align-vertical center command. */
924 /*****************************************************************************/
926 gl_ui_cmd_objects_align_vcenter (GtkAction *action,
930 gl_debug (DEBUG_COMMANDS, "START");
932 g_return_if_fail (action && GTK_IS_ACTION(action));
933 g_return_if_fail (window && GL_IS_WINDOW(window));
935 if (window->view != NULL) {
936 gl_view_align_selection_vcenter (GL_VIEW(window->view));
939 gl_debug (DEBUG_COMMANDS, "END");
942 /*****************************************************************************/
943 /** Objects/Center-horizontally command. */
944 /*****************************************************************************/
946 gl_ui_cmd_objects_center_horiz (GtkAction *action,
950 gl_debug (DEBUG_COMMANDS, "START");
952 g_return_if_fail (action && GTK_IS_ACTION(action));
953 g_return_if_fail (window && GL_IS_WINDOW(window));
955 if (window->view != NULL) {
956 gl_view_center_selection_horiz (GL_VIEW(window->view));
959 gl_debug (DEBUG_COMMANDS, "END");
962 /*****************************************************************************/
963 /** Objects/Center-vertically command. */
964 /*****************************************************************************/
966 gl_ui_cmd_objects_center_vert (GtkAction *action,
970 gl_debug (DEBUG_COMMANDS, "START");
972 g_return_if_fail (action && GTK_IS_ACTION(action));
973 g_return_if_fail (window && GL_IS_WINDOW(window));
975 if (window->view != NULL) {
976 gl_view_center_selection_vert (GL_VIEW(window->view));
979 gl_debug (DEBUG_COMMANDS, "END");
982 /*****************************************************************************/
983 /** Objects/Edit- merge-properties command. */
984 /*****************************************************************************/
986 gl_ui_cmd_objects_merge_properties (GtkAction *action,
990 gl_debug (DEBUG_COMMANDS, "START");
992 g_return_if_fail (action && GTK_IS_ACTION(action));
993 g_return_if_fail (window && GL_IS_WINDOW(window));
995 if (window->merge_dialog) {
997 gtk_window_present (GTK_WINDOW(window->merge_dialog));
998 gtk_window_set_transient_for (GTK_WINDOW (window->merge_dialog),
999 GTK_WINDOW (window));
1003 window->merge_dialog =
1005 gl_merge_properties_dialog_new (GL_VIEW(window->view)->label,
1006 GTK_WINDOW(window)) );
1008 g_signal_connect (G_OBJECT(window->merge_dialog), "destroy",
1009 G_CALLBACK (gtk_widget_destroyed),
1010 &window->merge_dialog);
1012 gtk_widget_show (GTK_WIDGET (window->merge_dialog));
1016 gl_debug (DEBUG_COMMANDS, "END");
1019 /****************************************************************************/
1020 /** Help/Contents command. */
1021 /****************************************************************************/
1023 gl_ui_cmd_help_contents (GtkAction *action,
1026 GError *error = NULL;
1028 gl_debug (DEBUG_COMMANDS, "START");
1030 g_return_if_fail (action && GTK_IS_ACTION(action));
1031 g_return_if_fail (window && GL_IS_WINDOW(window));
1033 gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (window)),
1040 g_message ("%s", error->message);
1042 g_error_free (error);
1045 gl_debug (DEBUG_COMMANDS, "END");
1049 /****************************************************************************/
1050 /** Help/About command. */
1051 /****************************************************************************/
1053 gl_ui_cmd_help_about (GtkAction *action,
1056 static GtkWidget *about = NULL;
1058 GdkPixbuf *pixbuf = NULL;
1060 const gchar *authors[] = {
1063 _("Glabels includes contributions from:"),
1069 _("See the file AUTHORS for additional credits,"),
1070 _("or visit http://glabels.sourceforge.net/"),
1074 const gchar *artists[] = {
1080 const gchar *copy_text = "Copyright \xc2\xa9 2001-2009 Jim Evins";
1082 const gchar *about_text = _("A label and business card creation program.\n");
1084 const gchar *url = "http://glabels.sourceforge.net";
1086 const gchar *translator_credits = _("translator-credits");
1088 const gchar *license = _(
1089 "Glabels is free software; you can redistribute it and/or modify it\n"
1090 "under the terms of the GNU General Public License as published by\n"
1091 "the Free Software Foundation; either version 2 of the License, or\n"
1092 "(at your option) any later version.\n" "\n"
1093 "This program is distributed in the hope that it will be useful, but\n"
1094 "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
1095 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\n"
1096 "the GNU General Public License for more details.\n");
1098 gl_debug (DEBUG_COMMANDS, "START");
1100 g_return_if_fail (action && GTK_IS_ACTION(action));
1101 g_return_if_fail (window && GL_IS_WINDOW(window));
1106 gtk_window_present (GTK_WINDOW (about));
1107 gtk_window_set_transient_for (GTK_WINDOW (about),
1108 GTK_WINDOW (window));
1112 pixbuf = gdk_pixbuf_new_from_file (GLABELS_PIXMAP_DIR "glabels-splash.png", NULL);
1114 about = gtk_about_dialog_new ();
1115 gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG(about), _("glabels"));
1116 gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about), VERSION);
1117 gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about), copy_text);
1118 gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG(about), about_text);
1119 gtk_about_dialog_set_website (GTK_ABOUT_DIALOG(about), url);
1120 gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about), pixbuf);
1122 gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG(about), authors);
1123 gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG(about), artists);
1124 gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about),
1125 translator_credits);
1126 gtk_about_dialog_set_license (GTK_ABOUT_DIALOG(about), license);
1128 gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);
1130 g_signal_connect (G_OBJECT (about), "response",
1131 G_CALLBACK (gtk_widget_destroy), NULL);
1132 g_signal_connect (G_OBJECT (about), "destroy",
1133 G_CALLBACK (gtk_widget_destroyed), &about);
1135 gtk_window_set_transient_for (GTK_WINDOW (about),
1136 GTK_WINDOW (window));
1138 gtk_window_present (GTK_WINDOW (about));
1141 g_object_unref (pixbuf);
1145 gl_debug (DEBUG_COMMANDS, "END");