3 * Copyright (C) 2001-2009 Jim Evins <evins@snaught.com>.
5 * This file is part of gLabels.
7 * gLabels is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * gLabels 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 gLabels. If not, see <http://www.gnu.org/licenses/>.
23 #include "ui-commands.h"
25 #include <glib/gi18n.h>
31 #include "template-designer.h"
32 #include "print-op-dialog.h"
34 #include "prefs-dialog.h"
39 /****************************************************************************/
40 /** File/New command. */
41 /****************************************************************************/
43 gl_ui_cmd_file_new (GtkAction *action,
46 gl_debug (DEBUG_COMMANDS, "START");
48 g_return_if_fail (action && GTK_IS_ACTION(action));
49 g_return_if_fail (window && GL_IS_WINDOW(window));
53 gl_debug (DEBUG_COMMANDS, "END");
57 /****************************************************************************/
58 /** File/Properties command. */
59 /****************************************************************************/
61 gl_ui_cmd_file_properties (GtkAction *action,
64 gl_debug (DEBUG_COMMANDS, "START");
66 g_return_if_fail (action && GTK_IS_ACTION(action));
67 g_return_if_fail (window && GL_IS_WINDOW(window));
69 gl_file_properties (GL_VIEW(window->view)->label, window);
71 gl_debug (DEBUG_COMMANDS, "END");
75 /****************************************************************************/
76 /** File/Template-Designer command. */
77 /****************************************************************************/
79 gl_ui_cmd_file_template_designer (GtkAction *action,
84 gl_debug (DEBUG_COMMANDS, "START");
86 g_return_if_fail (action && GTK_IS_ACTION(action));
87 g_return_if_fail (window && GL_IS_WINDOW(window));
89 dialog = gl_template_designer_new (GTK_WINDOW(window));
91 gtk_widget_show (dialog);
93 gl_debug (DEBUG_COMMANDS, "END");
97 /****************************************************************************/
98 /** File/Open command. */
99 /****************************************************************************/
101 gl_ui_cmd_file_open (GtkAction *action,
104 gl_debug (DEBUG_COMMANDS, "START");
106 g_return_if_fail (action && GTK_IS_ACTION(action));
107 g_return_if_fail (window && GL_IS_WINDOW(window));
109 gl_file_open (window);
111 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");
145 /****************************************************************************/
146 /** File/Save command. */
147 /****************************************************************************/
149 gl_ui_cmd_file_save (GtkAction *action,
152 gl_debug (DEBUG_COMMANDS, "START");
154 g_return_if_fail (action && GTK_IS_ACTION(action));
155 g_return_if_fail (window && GL_IS_WINDOW(window));
157 gl_file_save (GL_VIEW(window->view)->label, window);
159 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");
181 /****************************************************************************/
182 /** File/Print command. */
183 /****************************************************************************/
185 gl_ui_cmd_file_print (GtkAction *action,
189 GtkPrintOperationResult result;
191 gl_debug (DEBUG_COMMANDS, "START");
193 g_return_if_fail (action && GTK_IS_ACTION(action));
194 g_return_if_fail (window && GL_IS_WINDOW(window));
196 op = gl_print_op_dialog_new (GL_VIEW(window->view)->label);
198 if (window->print_settings)
200 gl_print_op_set_settings (GL_PRINT_OP (op), window->print_settings);
203 result = gtk_print_operation_run (GTK_PRINT_OPERATION (op),
204 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
208 if ( result == GTK_PRINT_OPERATION_RESULT_APPLY )
210 gl_print_op_free_settings (window->print_settings);
211 window->print_settings = gl_print_op_get_settings (GL_PRINT_OP (op));
214 gl_debug (DEBUG_COMMANDS, "END");
218 /****************************************************************************/
219 /** File/Close command. */
220 /****************************************************************************/
222 gl_ui_cmd_file_close (GtkAction *action,
225 gl_debug (DEBUG_COMMANDS, "START");
227 g_return_if_fail (action && GTK_IS_ACTION(action));
228 g_return_if_fail (window && GL_IS_WINDOW(window));
230 gl_file_close (window);
232 gl_debug (DEBUG_COMMANDS, "END");
236 /****************************************************************************/
237 /** File/Quit command. */
238 /****************************************************************************/
240 gl_ui_cmd_file_quit (GtkAction *action,
243 gl_debug (DEBUG_COMMANDS, "START");
245 g_return_if_fail (action && GTK_IS_ACTION(action));
246 g_return_if_fail (window && GL_IS_WINDOW(window));
250 gl_debug (DEBUG_COMMANDS, "END");
254 /****************************************************************************/
255 /** Edit/Undo command. */
256 /****************************************************************************/
258 gl_ui_cmd_edit_undo (GtkAction *action,
261 gl_debug (DEBUG_COMMANDS, "START");
263 g_return_if_fail (action && GTK_IS_ACTION(action));
264 g_return_if_fail (window && GL_IS_WINDOW(window));
266 gl_label_undo (GL_LABEL (GL_VIEW (window->view)->label));
268 gl_debug (DEBUG_COMMANDS, "END");
272 /****************************************************************************/
273 /** Edit/Redo command. */
274 /****************************************************************************/
276 gl_ui_cmd_edit_redo (GtkAction *action,
279 gl_debug (DEBUG_COMMANDS, "START");
281 g_return_if_fail (action && GTK_IS_ACTION(action));
282 g_return_if_fail (window && GL_IS_WINDOW(window));
284 gl_label_redo (GL_LABEL (GL_VIEW (window->view)->label));
286 gl_debug (DEBUG_COMMANDS, "END");
290 /****************************************************************************/
291 /** Edit/Cut command. */
292 /****************************************************************************/
294 gl_ui_cmd_edit_cut (GtkAction *action,
297 gl_debug (DEBUG_COMMANDS, "START");
299 g_return_if_fail (action && GTK_IS_ACTION(action));
300 g_return_if_fail (window && GL_IS_WINDOW(window));
302 gl_label_cut_selection (window->label);
304 gl_debug (DEBUG_COMMANDS, "END");
308 /****************************************************************************/
309 /** Edit/Copy command. */
310 /****************************************************************************/
312 gl_ui_cmd_edit_copy (GtkAction *action,
315 gl_debug (DEBUG_COMMANDS, "START");
317 g_return_if_fail (action && GTK_IS_ACTION(action));
318 g_return_if_fail (window && GL_IS_WINDOW(window));
320 gl_label_copy_selection (window->label);
322 gl_debug (DEBUG_COMMANDS, "END");
326 /****************************************************************************/
327 /** Edit/Paste command. */
328 /****************************************************************************/
330 gl_ui_cmd_edit_paste (GtkAction *action,
333 gl_debug (DEBUG_COMMANDS, "START");
335 g_return_if_fail (action && GTK_IS_ACTION(action));
336 g_return_if_fail (window && GL_IS_WINDOW(window));
338 gl_label_paste (window->label);
340 gl_debug (DEBUG_COMMANDS, "END");
344 /****************************************************************************/
345 /** Edit/Delete command. */
346 /****************************************************************************/
348 gl_ui_cmd_edit_delete (GtkAction *action,
351 gl_debug (DEBUG_COMMANDS, "START");
353 g_return_if_fail (action && GTK_IS_ACTION(action));
354 g_return_if_fail (window && GL_IS_WINDOW(window));
356 gl_label_delete_selection (GL_VIEW(window->view)->label);
358 gl_debug (DEBUG_COMMANDS, "END");
362 /****************************************************************************/
363 /** Edit/Select-all command. */
364 /****************************************************************************/
366 gl_ui_cmd_edit_select_all (GtkAction *action,
369 gl_debug (DEBUG_COMMANDS, "START");
371 g_return_if_fail (action && GTK_IS_ACTION(action));
372 g_return_if_fail (window && GL_IS_WINDOW(window));
374 gl_label_select_all (GL_VIEW(window->view)->label);
376 gl_debug (DEBUG_COMMANDS, "END");
380 /****************************************************************************/
381 /** Edit/Unselect-all command. */
382 /****************************************************************************/
384 gl_ui_cmd_edit_unselect_all (GtkAction *action,
387 gl_debug (DEBUG_COMMANDS, "START");
389 g_return_if_fail (action && GTK_IS_ACTION(action));
390 g_return_if_fail (window && GL_IS_WINDOW(window));
392 gl_label_unselect_all (GL_VIEW(window->view)->label);
394 gl_debug (DEBUG_COMMANDS, "END");
398 /****************************************************************************/
399 /** Edit/Preferences command. */
400 /****************************************************************************/
402 gl_ui_cmd_edit_preferences (GtkAction *action,
405 static GtkWidget *dialog = NULL;
407 gl_debug (DEBUG_COMMANDS, "START");
409 g_return_if_fail (action && GTK_IS_ACTION(action));
410 g_return_if_fail (window && GL_IS_WINDOW(window));
414 gtk_window_present (GTK_WINDOW (dialog));
415 gtk_window_set_transient_for (GTK_WINDOW (dialog),
420 dialog = gl_prefs_dialog_new (GTK_WINDOW(window));
422 g_signal_connect (G_OBJECT (dialog), "destroy",
423 G_CALLBACK (gtk_widget_destroyed), &dialog);
425 gtk_widget_show (dialog);
429 gl_debug (DEBUG_COMMANDS, "END");
433 /*****************************************************************************/
434 /** View/Property-bar-toggle command. */
435 /*****************************************************************************/
437 gl_ui_cmd_view_property_bar_toggle (GtkToggleAction *action,
442 gl_debug (DEBUG_COMMANDS, "START");
444 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
445 g_return_if_fail (window && GL_IS_WINDOW(window));
447 state = gtk_toggle_action_get_active (action);
449 gl_prefs_model_set_property_toolbar_visible (gl_prefs, state);
451 gtk_widget_show (GTK_WIDGET (window->property_bar));
453 gtk_widget_hide (GTK_WIDGET (window->property_bar));
456 gl_debug (DEBUG_COMMANDS, "END");
460 /*****************************************************************************/
461 /** View/Grid-toggle command. */
462 /*****************************************************************************/
464 gl_ui_cmd_view_grid_toggle (GtkToggleAction *action,
469 gl_debug (DEBUG_COMMANDS, "START");
471 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
472 g_return_if_fail (window && GL_IS_WINDOW(window));
474 state = gtk_toggle_action_get_active (action);
476 if (window->view != NULL)
479 gl_view_show_grid (GL_VIEW(window->view));
481 gl_view_hide_grid (GL_VIEW(window->view));
485 gl_prefs_model_set_grid_visible (gl_prefs, state);
487 gl_debug (DEBUG_COMMANDS, "END");
491 /*****************************************************************************/
492 /** View/Markup-toggle command. */
493 /*****************************************************************************/
495 gl_ui_cmd_view_markup_toggle (GtkToggleAction *action,
500 gl_debug (DEBUG_COMMANDS, "START");
502 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
503 g_return_if_fail (window && GL_IS_WINDOW(window));
505 state = gtk_toggle_action_get_active (action);
507 if (window->view != NULL)
510 gl_view_show_markup (GL_VIEW(window->view));
512 gl_view_hide_markup (GL_VIEW(window->view));
516 gl_prefs_model_set_markup_visible (gl_prefs, state);
518 gl_debug (DEBUG_COMMANDS, "END");
522 /*****************************************************************************/
523 /** View/Zoom-in command. */
524 /*****************************************************************************/
526 gl_ui_cmd_view_zoomin (GtkAction *action,
530 gl_debug (DEBUG_COMMANDS, "START");
532 g_return_if_fail (action && GTK_IS_ACTION(action));
533 g_return_if_fail (window && GL_IS_WINDOW(window));
535 if (window->view != NULL) {
536 gl_view_zoom_in (GL_VIEW(window->view));
539 gl_debug (DEBUG_COMMANDS, "END");
543 /*****************************************************************************/
544 /** View/Zoom-out command. */
545 /*****************************************************************************/
547 gl_ui_cmd_view_zoomout (GtkAction *action,
551 gl_debug (DEBUG_COMMANDS, "START");
553 g_return_if_fail (action && GTK_IS_ACTION(action));
554 g_return_if_fail (window && GL_IS_WINDOW(window));
556 if (window->view != NULL) {
557 gl_view_zoom_out (GL_VIEW(window->view));
560 gl_debug (DEBUG_COMMANDS, "END");
564 /*****************************************************************************/
565 /** View/Zoom-1:1 command. */
566 /*****************************************************************************/
568 gl_ui_cmd_view_zoom1to1 (GtkAction *action,
572 gl_debug (DEBUG_COMMANDS, "START");
574 g_return_if_fail (action && GTK_IS_ACTION(action));
575 g_return_if_fail (window && GL_IS_WINDOW(window));
577 if (window->view != NULL) {
578 gl_view_set_zoom (GL_VIEW(window->view), 1.0);
581 gl_debug (DEBUG_COMMANDS, "END");
585 /*****************************************************************************/
586 /** View/Zoom-to-fit command. */
587 /*****************************************************************************/
589 gl_ui_cmd_view_zoom_to_fit (GtkAction *action,
593 gl_debug (DEBUG_COMMANDS, "START");
595 g_return_if_fail (action && GTK_IS_ACTION(action));
596 g_return_if_fail (window && GL_IS_WINDOW(window));
598 if (window->view != NULL) {
599 gl_view_zoom_to_fit (GL_VIEW(window->view));
602 gl_debug (DEBUG_COMMANDS, "END");
606 /*****************************************************************************/
607 /** Objects/Arrow-mode command. */
608 /*****************************************************************************/
610 gl_ui_cmd_objects_arrow_mode (GtkAction *action,
613 gl_debug (DEBUG_COMMANDS, "START");
615 g_return_if_fail (action && GTK_IS_ACTION(action));
616 g_return_if_fail (window && GL_IS_WINDOW(window));
618 if (window->view != NULL) {
619 gl_view_arrow_mode (GL_VIEW(window->view));
622 gl_debug (DEBUG_COMMANDS, "END");
626 /*****************************************************************************/
627 /** Objects/Create-text object command. */
628 /*****************************************************************************/
630 gl_ui_cmd_objects_create_text (GtkAction *action,
634 gl_debug (DEBUG_COMMANDS, "START");
636 g_return_if_fail (action && GTK_IS_ACTION(action));
637 g_return_if_fail (window && GL_IS_WINDOW(window));
639 if (window->view != NULL) {
640 gl_view_object_create_mode (GL_VIEW(window->view),
641 GL_LABEL_OBJECT_TEXT);
644 gl_debug (DEBUG_COMMANDS, "END");
648 /*****************************************************************************/
649 /** Objects/Create-box object command. */
650 /*****************************************************************************/
652 gl_ui_cmd_objects_create_box (GtkAction *action,
656 gl_debug (DEBUG_COMMANDS, "START");
658 g_return_if_fail (action && GTK_IS_ACTION(action));
659 g_return_if_fail (window && GL_IS_WINDOW(window));
661 if (window->view != NULL) {
662 gl_view_object_create_mode (GL_VIEW(window->view),
663 GL_LABEL_OBJECT_BOX);
666 gl_debug (DEBUG_COMMANDS, "END");
670 /*****************************************************************************/
671 /** Objects/Create-line object command. */
672 /*****************************************************************************/
674 gl_ui_cmd_objects_create_line (GtkAction *action,
678 gl_debug (DEBUG_COMMANDS, "START");
680 g_return_if_fail (action && GTK_IS_ACTION(action));
681 g_return_if_fail (window && GL_IS_WINDOW(window));
683 if (window->view != NULL) {
684 gl_view_object_create_mode (GL_VIEW(window->view),
685 GL_LABEL_OBJECT_LINE);
688 gl_debug (DEBUG_COMMANDS, "END");
692 /*****************************************************************************/
693 /** Objects/Create-ellipse object command. */
694 /*****************************************************************************/
696 gl_ui_cmd_objects_create_ellipse (GtkAction *action,
700 gl_debug (DEBUG_COMMANDS, "START");
702 g_return_if_fail (action && GTK_IS_ACTION(action));
703 g_return_if_fail (window && GL_IS_WINDOW(window));
705 if (window->view != NULL) {
706 gl_view_object_create_mode (GL_VIEW(window->view),
707 GL_LABEL_OBJECT_ELLIPSE);
710 gl_debug (DEBUG_COMMANDS, "END");
714 /*****************************************************************************/
715 /** Objects/Create-image object command. */
716 /*****************************************************************************/
718 gl_ui_cmd_objects_create_image (GtkAction *action,
722 gl_debug (DEBUG_COMMANDS, "START");
724 g_return_if_fail (action && GTK_IS_ACTION(action));
725 g_return_if_fail (window && GL_IS_WINDOW(window));
727 if (window->view != NULL) {
728 gl_view_object_create_mode (GL_VIEW(window->view),
729 GL_LABEL_OBJECT_IMAGE);
732 gl_debug (DEBUG_COMMANDS, "END");
736 /*****************************************************************************/
737 /** Objects/Create-barcode object command. */
738 /*****************************************************************************/
740 gl_ui_cmd_objects_create_barcode (GtkAction *action,
744 gl_debug (DEBUG_COMMANDS, "START");
746 g_return_if_fail (action && GTK_IS_ACTION(action));
747 g_return_if_fail (window && GL_IS_WINDOW(window));
749 if (window->view != NULL) {
750 gl_view_object_create_mode (GL_VIEW(window->view),
751 GL_LABEL_OBJECT_BARCODE);
754 gl_debug (DEBUG_COMMANDS, "END");
758 /*****************************************************************************/
759 /** Objects/Raise command. */
760 /*****************************************************************************/
762 gl_ui_cmd_objects_raise (GtkAction *action,
766 gl_debug (DEBUG_COMMANDS, "START");
768 g_return_if_fail (action && GTK_IS_ACTION(action));
769 g_return_if_fail (window && GL_IS_WINDOW(window));
771 if (window->label != NULL) {
772 gl_label_raise_selection_to_top (window->label);
775 gl_debug (DEBUG_COMMANDS, "END");
779 /*****************************************************************************/
780 /** Objects/Lower command. */
781 /*****************************************************************************/
783 gl_ui_cmd_objects_lower (GtkAction *action,
787 gl_debug (DEBUG_COMMANDS, "START");
789 g_return_if_fail (action && GTK_IS_ACTION(action));
790 g_return_if_fail (window && GL_IS_WINDOW(window));
792 if (window->label != NULL) {
793 gl_label_lower_selection_to_bottom (window->label);
796 gl_debug (DEBUG_COMMANDS, "END");
800 /*****************************************************************************/
801 /** Objects/Rotate-left-90-degrees command. */
802 /*****************************************************************************/
804 gl_ui_cmd_objects_rotate_left (GtkAction *action,
808 gl_debug (DEBUG_COMMANDS, "START");
810 g_return_if_fail (action && GTK_IS_ACTION(action));
811 g_return_if_fail (window && GL_IS_WINDOW(window));
813 if (window->label != NULL) {
814 gl_label_rotate_selection_left (window->label);
817 gl_debug (DEBUG_COMMANDS, "END");
821 /*****************************************************************************/
822 /** Objects/Rotate-right-90-degrees command. */
823 /*****************************************************************************/
825 gl_ui_cmd_objects_rotate_right (GtkAction *action,
829 gl_debug (DEBUG_COMMANDS, "START");
831 g_return_if_fail (action && GTK_IS_ACTION(action));
832 g_return_if_fail (window && GL_IS_WINDOW(window));
834 if (window->label != NULL) {
835 gl_label_rotate_selection_right (window->label);
838 gl_debug (DEBUG_COMMANDS, "END");
842 /*****************************************************************************/
843 /** Objects/Flip-horizontally command. */
844 /*****************************************************************************/
846 gl_ui_cmd_objects_flip_horiz (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->label != NULL) {
856 gl_label_flip_selection_horiz (window->label);
859 gl_debug (DEBUG_COMMANDS, "END");
863 /*****************************************************************************/
864 /** Objects/Flip-vertically command. */
865 /*****************************************************************************/
867 gl_ui_cmd_objects_flip_vert (GtkAction *action,
871 gl_debug (DEBUG_COMMANDS, "START");
873 g_return_if_fail (action && GTK_IS_ACTION(action));
874 g_return_if_fail (window && GL_IS_WINDOW(window));
876 if (window->label != NULL) {
877 gl_label_flip_selection_vert (window->label);
880 gl_debug (DEBUG_COMMANDS, "END");
884 /*****************************************************************************/
885 /** Objects/Align-left command. */
886 /*****************************************************************************/
888 gl_ui_cmd_objects_align_left (GtkAction *action,
892 gl_debug (DEBUG_COMMANDS, "START");
894 g_return_if_fail (action && GTK_IS_ACTION(action));
895 g_return_if_fail (window && GL_IS_WINDOW(window));
897 if (window->label != NULL) {
898 gl_label_align_selection_left (window->label);
901 gl_debug (DEBUG_COMMANDS, "END");
905 /*****************************************************************************/
906 /** Objects/Align-right command. */
907 /*****************************************************************************/
909 gl_ui_cmd_objects_align_right (GtkAction *action,
913 gl_debug (DEBUG_COMMANDS, "START");
915 g_return_if_fail (action && GTK_IS_ACTION(action));
916 g_return_if_fail (window && GL_IS_WINDOW(window));
918 if (window->label != NULL) {
919 gl_label_align_selection_right (window->label);
922 gl_debug (DEBUG_COMMANDS, "END");
926 /*****************************************************************************/
927 /** Objects/Align-horizontal-center command. */
928 /*****************************************************************************/
930 gl_ui_cmd_objects_align_hcenter (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->label != NULL) {
940 gl_label_align_selection_hcenter (window->label);
943 gl_debug (DEBUG_COMMANDS, "END");
947 /*****************************************************************************/
948 /** Objects/Align-top command. */
949 /*****************************************************************************/
951 gl_ui_cmd_objects_align_top (GtkAction *action,
955 gl_debug (DEBUG_COMMANDS, "START");
957 g_return_if_fail (action && GTK_IS_ACTION(action));
958 g_return_if_fail (window && GL_IS_WINDOW(window));
960 if (window->label != NULL) {
961 gl_label_align_selection_top (window->label);
964 gl_debug (DEBUG_COMMANDS, "END");
968 /*****************************************************************************/
969 /** Objects/Align-bottom command. */
970 /*****************************************************************************/
972 gl_ui_cmd_objects_align_bottom (GtkAction *action,
976 gl_debug (DEBUG_COMMANDS, "START");
978 g_return_if_fail (action && GTK_IS_ACTION(action));
979 g_return_if_fail (window && GL_IS_WINDOW(window));
981 if (window->label != NULL) {
982 gl_label_align_selection_bottom (window->label);
985 gl_debug (DEBUG_COMMANDS, "END");
989 /*****************************************************************************/
990 /** Objects/Align-vertical center command. */
991 /*****************************************************************************/
993 gl_ui_cmd_objects_align_vcenter (GtkAction *action,
997 gl_debug (DEBUG_COMMANDS, "START");
999 g_return_if_fail (action && GTK_IS_ACTION(action));
1000 g_return_if_fail (window && GL_IS_WINDOW(window));
1002 if (window->label != NULL) {
1003 gl_label_align_selection_vcenter (window->label);
1006 gl_debug (DEBUG_COMMANDS, "END");
1010 /*****************************************************************************/
1011 /** Objects/Center-horizontally command. */
1012 /*****************************************************************************/
1014 gl_ui_cmd_objects_center_horiz (GtkAction *action,
1018 gl_debug (DEBUG_COMMANDS, "START");
1020 g_return_if_fail (action && GTK_IS_ACTION(action));
1021 g_return_if_fail (window && GL_IS_WINDOW(window));
1023 if (window->label != NULL) {
1024 gl_label_center_selection_horiz (window->label);
1027 gl_debug (DEBUG_COMMANDS, "END");
1031 /*****************************************************************************/
1032 /** Objects/Center-vertically command. */
1033 /*****************************************************************************/
1035 gl_ui_cmd_objects_center_vert (GtkAction *action,
1039 gl_debug (DEBUG_COMMANDS, "START");
1041 g_return_if_fail (action && GTK_IS_ACTION(action));
1042 g_return_if_fail (window && GL_IS_WINDOW(window));
1044 if (window->label != NULL) {
1045 gl_label_center_selection_vert (window->label);
1048 gl_debug (DEBUG_COMMANDS, "END");
1052 /*****************************************************************************/
1053 /** Objects/Edit- merge-properties command. */
1054 /*****************************************************************************/
1056 gl_ui_cmd_objects_merge_properties (GtkAction *action,
1060 gl_debug (DEBUG_COMMANDS, "START");
1062 g_return_if_fail (action && GTK_IS_ACTION(action));
1063 g_return_if_fail (window && GL_IS_WINDOW(window));
1065 if (window->merge_dialog) {
1067 gtk_window_present (GTK_WINDOW(window->merge_dialog));
1068 gtk_window_set_transient_for (GTK_WINDOW (window->merge_dialog),
1069 GTK_WINDOW (window));
1073 window->merge_dialog =
1075 gl_merge_properties_dialog_new (GL_VIEW(window->view)->label,
1076 GTK_WINDOW(window)) );
1078 g_signal_connect (G_OBJECT(window->merge_dialog), "destroy",
1079 G_CALLBACK (gtk_widget_destroyed),
1080 &window->merge_dialog);
1082 gtk_widget_show (GTK_WIDGET (window->merge_dialog));
1086 gl_debug (DEBUG_COMMANDS, "END");
1090 /****************************************************************************/
1091 /** Help/Contents command. */
1092 /****************************************************************************/
1094 gl_ui_cmd_help_contents (GtkAction *action,
1097 GError *error = NULL;
1099 gl_debug (DEBUG_COMMANDS, "START");
1101 g_return_if_fail (action && GTK_IS_ACTION(action));
1102 g_return_if_fail (window && GL_IS_WINDOW(window));
1104 gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (window)),
1106 gtk_get_current_event_time(),
1111 g_message ("%s", error->message);
1113 g_error_free (error);
1116 gl_debug (DEBUG_COMMANDS, "END");
1120 /****************************************************************************/
1121 /** Help/About command. */
1122 /****************************************************************************/
1124 gl_ui_cmd_help_about (GtkAction *action,
1127 static GtkWidget *about = NULL;
1129 gchar *pixbuf_filename;
1130 GdkPixbuf *pixbuf = NULL;
1132 const gchar *authors[] = {
1135 _("Glabels includes contributions from:"),
1136 "Mario Blättermann",
1144 _("See the file AUTHORS for additional credits,"),
1145 _("or visit http://glabels.org/"),
1149 const gchar *documenters[] = {
1151 "Mario Blättermann",
1155 const gchar *artists[] = {
1160 const gchar *copy_text = "Copyright \xc2\xa9 2001-2012 Jim Evins";
1162 const gchar *about_text = _("A label and business card creation program.\n");
1164 const gchar *url = "http://glabels.org";
1166 const gchar *translator_credits = _("translator-credits");
1168 const gchar *license = _(
1169 "gLabels is free software: you can redistribute it and/or modify\n"
1170 "it under the terms of the GNU General Public License as published by\n"
1171 "the Free Software Foundation, either version 3 of the License, or\n"
1172 "(at your option) any later version.\n"
1174 "gLabels is distributed in the hope that it will be useful,\n"
1175 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
1176 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
1177 "GNU General Public License for more details.\n");
1179 gl_debug (DEBUG_COMMANDS, "START");
1181 g_return_if_fail (action && GTK_IS_ACTION(action));
1182 g_return_if_fail (window && GL_IS_WINDOW(window));
1187 gtk_window_present (GTK_WINDOW (about));
1188 gtk_window_set_transient_for (GTK_WINDOW (about),
1189 GTK_WINDOW (window));
1193 pixbuf_filename = g_build_filename (GLABELS_DATA_DIR, "pixmaps", "glabels-logo.png", NULL);
1194 pixbuf = gdk_pixbuf_new_from_file (pixbuf_filename, NULL);
1195 g_free (pixbuf_filename);
1197 about = gtk_about_dialog_new ();
1198 gtk_window_set_title (GTK_WINDOW(about), _("About glabels"));
1199 gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG(about), "glabels");
1200 gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about), VERSION);
1201 gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about), copy_text);
1202 gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG(about), about_text);
1203 gtk_about_dialog_set_website (GTK_ABOUT_DIALOG(about), url);
1204 gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about), pixbuf);
1206 gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG(about), authors);
1207 gtk_about_dialog_set_documenters (GTK_ABOUT_DIALOG(about), documenters);
1208 gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG(about), artists);
1209 gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about), translator_credits);
1210 gtk_about_dialog_set_license (GTK_ABOUT_DIALOG(about), license);
1212 gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);
1214 g_signal_connect (G_OBJECT (about), "response",
1215 G_CALLBACK (gtk_widget_destroy), NULL);
1216 g_signal_connect (G_OBJECT (about), "destroy",
1217 G_CALLBACK (gtk_widget_destroyed), &about);
1219 gtk_window_set_transient_for (GTK_WINDOW (about),
1220 GTK_WINDOW (window));
1222 gtk_window_present (GTK_WINDOW (about));
1225 g_object_unref (pixbuf);
1229 gl_debug (DEBUG_COMMANDS, "END");
1235 * Local Variables: -- emacs
1237 * c-basic-offset: 8 -- emacs
1238 * tab-width: 8 -- emacs
1239 * indent-tabs-mode: nil -- emacs