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>
30 #include <gtk/gtkwindow.h>
31 #include <gtk/gtkaboutdialog.h>
35 #include "template-designer.h"
38 #include "prefs-dialog.h"
44 /****************************************************************************/
45 /** File/New command. */
46 /****************************************************************************/
48 gl_ui_cmd_file_new (GtkAction *action,
51 gl_debug (DEBUG_COMMANDS, "START");
53 g_return_if_fail (action && GTK_IS_ACTION(action));
54 g_return_if_fail (window && GL_IS_WINDOW(window));
58 gl_debug (DEBUG_COMMANDS, "END");
61 /****************************************************************************/
62 /** File/Properties command. */
63 /****************************************************************************/
65 gl_ui_cmd_file_properties (GtkAction *action,
68 gl_debug (DEBUG_COMMANDS, "START");
70 g_return_if_fail (action && GTK_IS_ACTION(action));
71 g_return_if_fail (window && GL_IS_WINDOW(window));
73 gl_file_properties (GL_VIEW(window->view)->label, window);
75 gl_debug (DEBUG_COMMANDS, "END");
78 /****************************************************************************/
79 /** File/Template-Designer command. */
80 /****************************************************************************/
82 gl_ui_cmd_file_template_designer (GtkAction *action,
87 gl_debug (DEBUG_COMMANDS, "START");
89 g_return_if_fail (action && GTK_IS_ACTION(action));
90 g_return_if_fail (window && GL_IS_WINDOW(window));
92 dialog = gl_template_designer_new (GTK_WINDOW(window));
94 gtk_widget_show (dialog);
96 gl_debug (DEBUG_COMMANDS, "END");
99 /****************************************************************************/
100 /** File/Open command. */
101 /****************************************************************************/
103 gl_ui_cmd_file_open (GtkAction *action,
106 gl_debug (DEBUG_COMMANDS, "START");
108 g_return_if_fail (action && GTK_IS_ACTION(action));
109 g_return_if_fail (window && GL_IS_WINDOW(window));
111 gl_file_open (window);
113 gl_debug (DEBUG_COMMANDS, "END");
116 /****************************************************************************/
117 /** File/Open-Recent command. */
118 /****************************************************************************/
120 gl_ui_cmd_file_open_recent (GtkRecentChooser *chooser,
124 gchar *utf8_filename;
126 gl_debug (DEBUG_COMMANDS, "START");
128 g_return_if_fail (chooser && GTK_IS_RECENT_CHOOSER(chooser));
129 g_return_if_fail (window && GL_IS_WINDOW(window));
131 item = gtk_recent_chooser_get_current_item (chooser);
135 utf8_filename = gl_recent_get_utf8_filename (item);
137 gl_debug (DEBUG_COMMANDS, "Selected %s\n", utf8_filename);
138 gl_file_open_recent (utf8_filename, window);
140 gtk_recent_info_unref (item);
142 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");
162 /****************************************************************************/
163 /** File/Save-as command. */
164 /****************************************************************************/
166 gl_ui_cmd_file_save_as (GtkAction *action,
169 gl_debug (DEBUG_COMMANDS, "START");
171 g_return_if_fail (action && GTK_IS_ACTION(action));
172 g_return_if_fail (window && GL_IS_WINDOW(window));
174 gl_file_save_as (GL_VIEW(window->view)->label, window);
176 gl_debug (DEBUG_COMMANDS, "END");
179 /****************************************************************************/
180 /** File/Print command. */
181 /****************************************************************************/
183 gl_ui_cmd_file_print (GtkAction *action,
187 GtkPrintOperationResult result;
189 gl_debug (DEBUG_COMMANDS, "START");
191 g_return_if_fail (action && GTK_IS_ACTION(action));
192 g_return_if_fail (window && GL_IS_WINDOW(window));
194 op = gl_print_op_new (GL_VIEW(window->view)->label);
196 if (window->print_settings)
198 gl_print_op_set_settings (op, window->print_settings);
201 result = gtk_print_operation_run (GTK_PRINT_OPERATION (op),
202 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
206 if ( result == GTK_PRINT_OPERATION_RESULT_APPLY )
208 gl_print_op_free_settings (window->print_settings);
209 window->print_settings = gl_print_op_get_settings (op);
212 gl_debug (DEBUG_COMMANDS, "END");
215 /****************************************************************************/
216 /** File/Close command. */
217 /****************************************************************************/
219 gl_ui_cmd_file_close (GtkAction *action,
222 gl_debug (DEBUG_COMMANDS, "START");
224 g_return_if_fail (action && GTK_IS_ACTION(action));
225 g_return_if_fail (window && GL_IS_WINDOW(window));
227 gl_file_close (window);
229 gl_debug (DEBUG_COMMANDS, "END");
232 /****************************************************************************/
233 /** File/Quit command. */
234 /****************************************************************************/
236 gl_ui_cmd_file_quit (GtkAction *action,
239 gl_debug (DEBUG_COMMANDS, "START");
241 g_return_if_fail (action && GTK_IS_ACTION(action));
242 g_return_if_fail (window && GL_IS_WINDOW(window));
246 gl_debug (DEBUG_COMMANDS, "END");
250 /****************************************************************************/
251 /** Edit/Cut command. */
252 /****************************************************************************/
254 gl_ui_cmd_edit_cut (GtkAction *action,
257 gl_debug (DEBUG_COMMANDS, "START");
259 g_return_if_fail (action && GTK_IS_ACTION(action));
260 g_return_if_fail (window && GL_IS_WINDOW(window));
262 gl_view_cut (GL_VIEW(window->view));
264 gl_debug (DEBUG_COMMANDS, "END");
267 /****************************************************************************/
268 /** Edit/Copy command. */
269 /****************************************************************************/
271 gl_ui_cmd_edit_copy (GtkAction *action,
274 gl_debug (DEBUG_COMMANDS, "START");
276 g_return_if_fail (action && GTK_IS_ACTION(action));
277 g_return_if_fail (window && GL_IS_WINDOW(window));
279 gl_view_copy (GL_VIEW(window->view));
281 gl_debug (DEBUG_COMMANDS, "END");
284 /****************************************************************************/
285 /** Edit/Paste command. */
286 /****************************************************************************/
288 gl_ui_cmd_edit_paste (GtkAction *action,
291 gl_debug (DEBUG_COMMANDS, "START");
293 g_return_if_fail (action && GTK_IS_ACTION(action));
294 g_return_if_fail (window && GL_IS_WINDOW(window));
296 gl_view_paste (GL_VIEW(window->view));
298 gl_debug (DEBUG_COMMANDS, "END");
302 /****************************************************************************/
303 /** Edit/Delete command. */
304 /****************************************************************************/
306 gl_ui_cmd_edit_delete (GtkAction *action,
309 gl_debug (DEBUG_COMMANDS, "START");
311 g_return_if_fail (action && GTK_IS_ACTION(action));
312 g_return_if_fail (window && GL_IS_WINDOW(window));
314 gl_view_delete_selection (GL_VIEW(window->view));
316 gl_debug (DEBUG_COMMANDS, "END");
320 /****************************************************************************/
321 /** Edit/Select-all command. */
322 /****************************************************************************/
324 gl_ui_cmd_edit_select_all (GtkAction *action,
327 gl_debug (DEBUG_COMMANDS, "START");
329 g_return_if_fail (action && GTK_IS_ACTION(action));
330 g_return_if_fail (window && GL_IS_WINDOW(window));
332 gl_view_select_all (GL_VIEW(window->view));
334 gl_debug (DEBUG_COMMANDS, "END");
337 /****************************************************************************/
338 /** Edit/Unselect-all command. */
339 /****************************************************************************/
341 gl_ui_cmd_edit_unselect_all (GtkAction *action,
344 gl_debug (DEBUG_COMMANDS, "START");
346 g_return_if_fail (action && GTK_IS_ACTION(action));
347 g_return_if_fail (window && GL_IS_WINDOW(window));
349 gl_view_unselect_all (GL_VIEW(window->view));
351 gl_debug (DEBUG_COMMANDS, "END");
354 /****************************************************************************/
355 /** Edit/Preferences command. */
356 /****************************************************************************/
358 gl_ui_cmd_edit_preferences (GtkAction *action,
361 static GtkWidget *dialog = NULL;
363 gl_debug (DEBUG_COMMANDS, "START");
365 g_return_if_fail (action && GTK_IS_ACTION(action));
366 g_return_if_fail (window && GL_IS_WINDOW(window));
370 gtk_window_present (GTK_WINDOW (dialog));
371 gtk_window_set_transient_for (GTK_WINDOW (dialog),
376 dialog = gl_prefs_dialog_new (GTK_WINDOW(window));
378 g_signal_connect (G_OBJECT (dialog), "destroy",
379 G_CALLBACK (gtk_widget_destroyed), &dialog);
381 gtk_widget_show (dialog);
385 gl_debug (DEBUG_COMMANDS, "END");
388 /*****************************************************************************/
389 /** View/Property-bar-toggle command. */
390 /*****************************************************************************/
392 gl_ui_cmd_view_property_bar_toggle (GtkToggleAction *action,
397 gl_debug (DEBUG_COMMANDS, "START");
399 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
400 g_return_if_fail (window && GL_IS_WINDOW(window));
402 state = gtk_toggle_action_get_active (action);
404 gl_prefs->property_toolbar_visible = state;
406 gtk_widget_show (GTK_WIDGET (window->property_bar));
408 gtk_widget_hide (GTK_WIDGET (window->property_bar));
410 gl_prefs_model_save_settings (gl_prefs);
412 gl_debug (DEBUG_COMMANDS, "END");
416 /*****************************************************************************/
417 /** View/Grid-toggle command. */
418 /*****************************************************************************/
420 gl_ui_cmd_view_grid_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 if (window->view != NULL)
435 gl_view_show_grid (GL_VIEW(window->view));
437 gl_view_hide_grid (GL_VIEW(window->view));
441 gl_prefs->grid_visible = state;
442 gl_prefs_model_save_settings (gl_prefs);
444 gl_debug (DEBUG_COMMANDS, "END");
447 /*****************************************************************************/
448 /** View/Markup-toggle command. */
449 /*****************************************************************************/
451 gl_ui_cmd_view_markup_toggle (GtkToggleAction *action,
456 gl_debug (DEBUG_COMMANDS, "START");
458 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
459 g_return_if_fail (window && GL_IS_WINDOW(window));
461 state = gtk_toggle_action_get_active (action);
463 if (window->view != NULL)
466 gl_view_show_markup (GL_VIEW(window->view));
468 gl_view_hide_markup (GL_VIEW(window->view));
472 gl_prefs->markup_visible = state;
473 gl_prefs_model_save_settings (gl_prefs);
475 gl_debug (DEBUG_COMMANDS, "END");
478 /*****************************************************************************/
479 /** View/Zoom-in command. */
480 /*****************************************************************************/
482 gl_ui_cmd_view_zoomin (GtkAction *action,
486 gl_debug (DEBUG_COMMANDS, "START");
488 g_return_if_fail (action && GTK_IS_ACTION(action));
489 g_return_if_fail (window && GL_IS_WINDOW(window));
491 if (window->view != NULL) {
492 gl_view_zoom_in (GL_VIEW(window->view));
495 gl_debug (DEBUG_COMMANDS, "END");
498 /*****************************************************************************/
499 /** View/Zoom-out command. */
500 /*****************************************************************************/
502 gl_ui_cmd_view_zoomout (GtkAction *action,
506 gl_debug (DEBUG_COMMANDS, "START");
508 g_return_if_fail (action && GTK_IS_ACTION(action));
509 g_return_if_fail (window && GL_IS_WINDOW(window));
511 if (window->view != NULL) {
512 gl_view_zoom_out (GL_VIEW(window->view));
515 gl_debug (DEBUG_COMMANDS, "END");
518 /*****************************************************************************/
519 /** View/Zoom-1:1 command. */
520 /*****************************************************************************/
522 gl_ui_cmd_view_zoom1to1 (GtkAction *action,
526 gl_debug (DEBUG_COMMANDS, "START");
528 g_return_if_fail (action && GTK_IS_ACTION(action));
529 g_return_if_fail (window && GL_IS_WINDOW(window));
531 if (window->view != NULL) {
532 gl_view_set_zoom (GL_VIEW(window->view), 1.0);
535 gl_debug (DEBUG_COMMANDS, "END");
538 /*****************************************************************************/
539 /** View/Zoom-to-fit command. */
540 /*****************************************************************************/
542 gl_ui_cmd_view_zoom_to_fit (GtkAction *action,
546 gl_debug (DEBUG_COMMANDS, "START");
548 g_return_if_fail (action && GTK_IS_ACTION(action));
549 g_return_if_fail (window && GL_IS_WINDOW(window));
551 if (window->view != NULL) {
552 gl_view_zoom_to_fit (GL_VIEW(window->view));
555 gl_debug (DEBUG_COMMANDS, "END");
558 /*****************************************************************************/
559 /** Objects/Arrow-mode command. */
560 /*****************************************************************************/
562 gl_ui_cmd_objects_arrow_mode (GtkAction *action,
565 gl_debug (DEBUG_COMMANDS, "START");
567 g_return_if_fail (action && GTK_IS_ACTION(action));
568 g_return_if_fail (window && GL_IS_WINDOW(window));
570 if (window->view != NULL) {
571 gl_view_arrow_mode (GL_VIEW(window->view));
574 gl_debug (DEBUG_COMMANDS, "END");
577 /*****************************************************************************/
578 /** Objects/Create-text object command. */
579 /*****************************************************************************/
581 gl_ui_cmd_objects_create_text (GtkAction *action,
585 gl_debug (DEBUG_COMMANDS, "START");
587 g_return_if_fail (action && GTK_IS_ACTION(action));
588 g_return_if_fail (window && GL_IS_WINDOW(window));
590 if (window->view != NULL) {
591 gl_view_object_create_mode (GL_VIEW(window->view),
592 GL_LABEL_OBJECT_TEXT);
595 gl_debug (DEBUG_COMMANDS, "END");
598 /*****************************************************************************/
599 /** Objects/Create-box object command. */
600 /*****************************************************************************/
602 gl_ui_cmd_objects_create_box (GtkAction *action,
606 gl_debug (DEBUG_COMMANDS, "START");
608 g_return_if_fail (action && GTK_IS_ACTION(action));
609 g_return_if_fail (window && GL_IS_WINDOW(window));
611 if (window->view != NULL) {
612 gl_view_object_create_mode (GL_VIEW(window->view),
613 GL_LABEL_OBJECT_BOX);
616 gl_debug (DEBUG_COMMANDS, "END");
619 /*****************************************************************************/
620 /** Objects/Create-line object command. */
621 /*****************************************************************************/
623 gl_ui_cmd_objects_create_line (GtkAction *action,
627 gl_debug (DEBUG_COMMANDS, "START");
629 g_return_if_fail (action && GTK_IS_ACTION(action));
630 g_return_if_fail (window && GL_IS_WINDOW(window));
632 if (window->view != NULL) {
633 gl_view_object_create_mode (GL_VIEW(window->view),
634 GL_LABEL_OBJECT_LINE);
637 gl_debug (DEBUG_COMMANDS, "END");
640 /*****************************************************************************/
641 /** Objects/Create-ellipse object command. */
642 /*****************************************************************************/
644 gl_ui_cmd_objects_create_ellipse (GtkAction *action,
648 gl_debug (DEBUG_COMMANDS, "START");
650 g_return_if_fail (action && GTK_IS_ACTION(action));
651 g_return_if_fail (window && GL_IS_WINDOW(window));
653 if (window->view != NULL) {
654 gl_view_object_create_mode (GL_VIEW(window->view),
655 GL_LABEL_OBJECT_ELLIPSE);
658 gl_debug (DEBUG_COMMANDS, "END");
661 /*****************************************************************************/
662 /** Objects/Create-image object command. */
663 /*****************************************************************************/
665 gl_ui_cmd_objects_create_image (GtkAction *action,
669 gl_debug (DEBUG_COMMANDS, "START");
671 g_return_if_fail (action && GTK_IS_ACTION(action));
672 g_return_if_fail (window && GL_IS_WINDOW(window));
674 if (window->view != NULL) {
675 gl_view_object_create_mode (GL_VIEW(window->view),
676 GL_LABEL_OBJECT_IMAGE);
679 gl_debug (DEBUG_COMMANDS, "END");
682 /*****************************************************************************/
683 /** Objects/Create-barcode object command. */
684 /*****************************************************************************/
686 gl_ui_cmd_objects_create_barcode (GtkAction *action,
690 gl_debug (DEBUG_COMMANDS, "START");
692 g_return_if_fail (action && GTK_IS_ACTION(action));
693 g_return_if_fail (window && GL_IS_WINDOW(window));
695 if (window->view != NULL) {
696 gl_view_object_create_mode (GL_VIEW(window->view),
697 GL_LABEL_OBJECT_BARCODE);
700 gl_debug (DEBUG_COMMANDS, "END");
703 /*****************************************************************************/
704 /** Objects/Raise command. */
705 /*****************************************************************************/
707 gl_ui_cmd_objects_raise (GtkAction *action,
711 gl_debug (DEBUG_COMMANDS, "START");
713 g_return_if_fail (action && GTK_IS_ACTION(action));
714 g_return_if_fail (window && GL_IS_WINDOW(window));
716 if (window->view != NULL) {
717 gl_view_raise_selection (GL_VIEW(window->view));
720 gl_debug (DEBUG_COMMANDS, "END");
723 /*****************************************************************************/
724 /** Objects/Lower command. */
725 /*****************************************************************************/
727 gl_ui_cmd_objects_lower (GtkAction *action,
731 gl_debug (DEBUG_COMMANDS, "START");
733 g_return_if_fail (action && GTK_IS_ACTION(action));
734 g_return_if_fail (window && GL_IS_WINDOW(window));
736 if (window->view != NULL) {
737 gl_view_lower_selection (GL_VIEW(window->view));
740 gl_debug (DEBUG_COMMANDS, "END");
743 /*****************************************************************************/
744 /** Objects/Rotate-left-90-degrees command. */
745 /*****************************************************************************/
747 gl_ui_cmd_objects_rotate_left (GtkAction *action,
751 gl_debug (DEBUG_COMMANDS, "START");
753 g_return_if_fail (action && GTK_IS_ACTION(action));
754 g_return_if_fail (window && GL_IS_WINDOW(window));
756 if (window->view != NULL) {
757 gl_view_rotate_selection_left (GL_VIEW(window->view));
760 gl_debug (DEBUG_COMMANDS, "END");
763 /*****************************************************************************/
764 /** Objects/Rotate-right-90-degrees command. */
765 /*****************************************************************************/
767 gl_ui_cmd_objects_rotate_right (GtkAction *action,
771 gl_debug (DEBUG_COMMANDS, "START");
773 g_return_if_fail (action && GTK_IS_ACTION(action));
774 g_return_if_fail (window && GL_IS_WINDOW(window));
776 if (window->view != NULL) {
777 gl_view_rotate_selection_right (GL_VIEW(window->view));
780 gl_debug (DEBUG_COMMANDS, "END");
783 /*****************************************************************************/
784 /** Objects/Flip-horizontally command. */
785 /*****************************************************************************/
787 gl_ui_cmd_objects_flip_horiz (GtkAction *action,
791 gl_debug (DEBUG_COMMANDS, "START");
793 g_return_if_fail (action && GTK_IS_ACTION(action));
794 g_return_if_fail (window && GL_IS_WINDOW(window));
796 if (window->view != NULL) {
797 gl_view_flip_selection_horiz (GL_VIEW(window->view));
800 gl_debug (DEBUG_COMMANDS, "END");
803 /*****************************************************************************/
804 /** Objects/Flip-vertically command. */
805 /*****************************************************************************/
807 gl_ui_cmd_objects_flip_vert (GtkAction *action,
811 gl_debug (DEBUG_COMMANDS, "START");
813 g_return_if_fail (action && GTK_IS_ACTION(action));
814 g_return_if_fail (window && GL_IS_WINDOW(window));
816 if (window->view != NULL) {
817 gl_view_flip_selection_vert (GL_VIEW(window->view));
820 gl_debug (DEBUG_COMMANDS, "END");
823 /*****************************************************************************/
824 /** Objects/Align-left command. */
825 /*****************************************************************************/
827 gl_ui_cmd_objects_align_left (GtkAction *action,
831 gl_debug (DEBUG_COMMANDS, "START");
833 g_return_if_fail (action && GTK_IS_ACTION(action));
834 g_return_if_fail (window && GL_IS_WINDOW(window));
836 if (window->view != NULL) {
837 gl_view_align_selection_left (GL_VIEW(window->view));
840 gl_debug (DEBUG_COMMANDS, "END");
843 /*****************************************************************************/
844 /** Objects/Align-right command. */
845 /*****************************************************************************/
847 gl_ui_cmd_objects_align_right (GtkAction *action,
851 gl_debug (DEBUG_COMMANDS, "START");
853 g_return_if_fail (action && GTK_IS_ACTION(action));
854 g_return_if_fail (window && GL_IS_WINDOW(window));
856 if (window->view != NULL) {
857 gl_view_align_selection_right (GL_VIEW(window->view));
860 gl_debug (DEBUG_COMMANDS, "END");
863 /*****************************************************************************/
864 /** Objects/Align-horizontal-center command. */
865 /*****************************************************************************/
867 gl_ui_cmd_objects_align_hcenter (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->view != NULL) {
877 gl_view_align_selection_hcenter (GL_VIEW(window->view));
880 gl_debug (DEBUG_COMMANDS, "END");
883 /*****************************************************************************/
884 /** Objects/Align-top command. */
885 /*****************************************************************************/
887 gl_ui_cmd_objects_align_top (GtkAction *action,
891 gl_debug (DEBUG_COMMANDS, "START");
893 g_return_if_fail (action && GTK_IS_ACTION(action));
894 g_return_if_fail (window && GL_IS_WINDOW(window));
896 if (window->view != NULL) {
897 gl_view_align_selection_top (GL_VIEW(window->view));
900 gl_debug (DEBUG_COMMANDS, "END");
903 /*****************************************************************************/
904 /** Objects/Align-bottom command. */
905 /*****************************************************************************/
907 gl_ui_cmd_objects_align_bottom (GtkAction *action,
911 gl_debug (DEBUG_COMMANDS, "START");
913 g_return_if_fail (action && GTK_IS_ACTION(action));
914 g_return_if_fail (window && GL_IS_WINDOW(window));
916 if (window->view != NULL) {
917 gl_view_align_selection_bottom (GL_VIEW(window->view));
920 gl_debug (DEBUG_COMMANDS, "END");
923 /*****************************************************************************/
924 /** Objects/Align-vertical center command. */
925 /*****************************************************************************/
927 gl_ui_cmd_objects_align_vcenter (GtkAction *action,
931 gl_debug (DEBUG_COMMANDS, "START");
933 g_return_if_fail (action && GTK_IS_ACTION(action));
934 g_return_if_fail (window && GL_IS_WINDOW(window));
936 if (window->view != NULL) {
937 gl_view_align_selection_vcenter (GL_VIEW(window->view));
940 gl_debug (DEBUG_COMMANDS, "END");
943 /*****************************************************************************/
944 /** Objects/Center-horizontally command. */
945 /*****************************************************************************/
947 gl_ui_cmd_objects_center_horiz (GtkAction *action,
951 gl_debug (DEBUG_COMMANDS, "START");
953 g_return_if_fail (action && GTK_IS_ACTION(action));
954 g_return_if_fail (window && GL_IS_WINDOW(window));
956 if (window->view != NULL) {
957 gl_view_center_selection_horiz (GL_VIEW(window->view));
960 gl_debug (DEBUG_COMMANDS, "END");
963 /*****************************************************************************/
964 /** Objects/Center-vertically command. */
965 /*****************************************************************************/
967 gl_ui_cmd_objects_center_vert (GtkAction *action,
971 gl_debug (DEBUG_COMMANDS, "START");
973 g_return_if_fail (action && GTK_IS_ACTION(action));
974 g_return_if_fail (window && GL_IS_WINDOW(window));
976 if (window->view != NULL) {
977 gl_view_center_selection_vert (GL_VIEW(window->view));
980 gl_debug (DEBUG_COMMANDS, "END");
983 /*****************************************************************************/
984 /** Objects/Edit- merge-properties command. */
985 /*****************************************************************************/
987 gl_ui_cmd_objects_merge_properties (GtkAction *action,
991 gl_debug (DEBUG_COMMANDS, "START");
993 g_return_if_fail (action && GTK_IS_ACTION(action));
994 g_return_if_fail (window && GL_IS_WINDOW(window));
996 if (window->merge_dialog) {
998 gtk_window_present (GTK_WINDOW(window->merge_dialog));
999 gtk_window_set_transient_for (GTK_WINDOW (window->merge_dialog),
1000 GTK_WINDOW (window));
1004 window->merge_dialog =
1006 gl_merge_properties_dialog_new (GL_VIEW(window->view)->label,
1007 GTK_WINDOW(window)) );
1009 g_signal_connect (G_OBJECT(window->merge_dialog), "destroy",
1010 G_CALLBACK (gtk_widget_destroyed),
1011 &window->merge_dialog);
1013 gtk_widget_show (GTK_WIDGET (window->merge_dialog));
1017 gl_debug (DEBUG_COMMANDS, "END");
1020 /****************************************************************************/
1021 /** Help/Contents command. */
1022 /****************************************************************************/
1024 gl_ui_cmd_help_contents (GtkAction *action,
1027 GError *error = NULL;
1029 gl_debug (DEBUG_COMMANDS, "START");
1031 g_return_if_fail (action && GTK_IS_ACTION(action));
1032 g_return_if_fail (window && GL_IS_WINDOW(window));
1034 gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (window)),
1041 g_message ("%s", error->message);
1043 g_error_free (error);
1046 gl_debug (DEBUG_COMMANDS, "END");
1050 /****************************************************************************/
1051 /** Help/About command. */
1052 /****************************************************************************/
1054 gl_ui_cmd_help_about (GtkAction *action,
1057 static GtkWidget *about = NULL;
1059 GdkPixbuf *pixbuf = NULL;
1061 const gchar *authors[] = {
1064 _("Glabels includes contributions from:"),
1070 _("See the file AUTHORS for additional credits,"),
1071 _("or visit http://glabels.sourceforge.net/"),
1075 const gchar *artists[] = {
1081 const gchar *copy_text = "Copyright \xc2\xa9 2001-2009 Jim Evins";
1083 const gchar *about_text = _("A label and business card creation program.\n");
1085 const gchar *url = "http://glabels.sourceforge.net";
1087 const gchar *translator_credits = _("translator-credits");
1089 const gchar *license = _(
1090 "Glabels is free software; you can redistribute it and/or modify it\n"
1091 "under the terms of the GNU General Public License as published by\n"
1092 "the Free Software Foundation; either version 2 of the License, or\n"
1093 "(at your option) any later version.\n" "\n"
1094 "This program is distributed in the hope that it will be useful, but\n"
1095 "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
1096 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\n"
1097 "the GNU General Public License for more details.\n");
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));
1107 gtk_window_present (GTK_WINDOW (about));
1108 gtk_window_set_transient_for (GTK_WINDOW (about),
1109 GTK_WINDOW (window));
1113 pixbuf = gdk_pixbuf_new_from_file (GLABELS_PIXMAP_DIR "glabels-splash.png", NULL);
1115 about = gtk_about_dialog_new ();
1116 gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about), _("glabels"));
1117 gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about), VERSION);
1118 gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about), copy_text);
1119 gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG(about), about_text);
1120 gtk_about_dialog_set_website (GTK_ABOUT_DIALOG(about), url);
1121 gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about), pixbuf);
1123 gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG(about), authors);
1124 gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG(about), artists);
1125 gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about),
1126 translator_credits);
1127 gtk_about_dialog_set_license (GTK_ABOUT_DIALOG(about), license);
1129 gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);
1131 g_signal_connect (G_OBJECT (about), "response",
1132 G_CALLBACK (gtk_widget_destroy), NULL);
1133 g_signal_connect (G_OBJECT (about), "destroy",
1134 G_CALLBACK (gtk_widget_destroyed), &about);
1136 gtk_window_set_transient_for (GTK_WINDOW (about),
1137 GTK_WINDOW (window));
1139 gtk_window_present (GTK_WINDOW (about));
1142 g_object_unref (pixbuf);
1146 gl_debug (DEBUG_COMMANDS, "END");