1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
4 * (GLABELS) Label and Business Card Creation program for GNOME
6 * ui-commands.c: GLabels UI commands module
8 * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include "ui-commands.h"
29 #include <glib/gi18n.h>
30 #include <gtk/gtkwindow.h>
31 #include <gtk/gtkaboutdialog.h>
32 #include <libgnome/gnome-help.h>
33 #include <libgnome/gnome-url.h>
37 #include "template-designer.h"
40 #include "prefs-dialog.h"
44 #define LOGO_PIXMAP gnome_program_locate_file (NULL,\
45 GNOME_FILE_DOMAIN_APP_PIXMAP,\
46 "glabels/glabels-about-logo.png",\
50 /****************************************************************************/
51 /** File/New command. */
52 /****************************************************************************/
54 gl_ui_cmd_file_new (GtkAction *action,
57 gl_debug (DEBUG_COMMANDS, "START");
59 g_return_if_fail (action && GTK_IS_ACTION(action));
60 g_return_if_fail (window && GL_IS_WINDOW(window));
64 gl_debug (DEBUG_COMMANDS, "END");
67 /****************************************************************************/
68 /** File/Properties command. */
69 /****************************************************************************/
71 gl_ui_cmd_file_properties (GtkAction *action,
74 gl_debug (DEBUG_COMMANDS, "START");
76 g_return_if_fail (action && GTK_IS_ACTION(action));
77 g_return_if_fail (window && GL_IS_WINDOW(window));
79 gl_file_properties (GL_VIEW(window->view)->label, window);
81 gl_debug (DEBUG_COMMANDS, "END");
84 /****************************************************************************/
85 /** File/Template-Designer command. */
86 /****************************************************************************/
88 gl_ui_cmd_file_template_designer (GtkAction *action,
93 gl_debug (DEBUG_COMMANDS, "START");
95 g_return_if_fail (action && GTK_IS_ACTION(action));
96 g_return_if_fail (window && GL_IS_WINDOW(window));
98 dialog = gl_template_designer_new (GTK_WINDOW(window));
100 gtk_widget_show (dialog);
102 gl_debug (DEBUG_COMMANDS, "END");
105 /****************************************************************************/
106 /** File/Open command. */
107 /****************************************************************************/
109 gl_ui_cmd_file_open (GtkAction *action,
112 gl_debug (DEBUG_COMMANDS, "START");
114 g_return_if_fail (action && GTK_IS_ACTION(action));
115 g_return_if_fail (window && GL_IS_WINDOW(window));
117 gl_file_open (window);
119 gl_debug (DEBUG_COMMANDS, "END");
122 /****************************************************************************/
123 /** File/Open-Recent command. */
124 /****************************************************************************/
126 gl_ui_cmd_file_open_recent (GtkRecentChooser *chooser,
130 gchar *utf8_filename;
132 gl_debug (DEBUG_COMMANDS, "START");
134 g_return_if_fail (chooser && GTK_IS_RECENT_CHOOSER(chooser));
135 g_return_if_fail (window && GL_IS_WINDOW(window));
137 item = gtk_recent_chooser_get_current_item (chooser);
141 utf8_filename = gl_recent_get_utf8_filename (item);
143 gl_debug (DEBUG_COMMANDS, "Selected %s\n", utf8_filename);
145 gl_file_open_recent (utf8_filename, window);
148 gtk_recent_info_unref (item);
150 gl_debug (DEBUG_COMMANDS, "END");
153 /****************************************************************************/
154 /** File/Save command. */
155 /****************************************************************************/
157 gl_ui_cmd_file_save (GtkAction *action,
160 gl_debug (DEBUG_COMMANDS, "START");
162 g_return_if_fail (action && GTK_IS_ACTION(action));
163 g_return_if_fail (window && GL_IS_WINDOW(window));
165 gl_file_save (GL_VIEW(window->view)->label, window);
167 gl_debug (DEBUG_COMMANDS, "END");
170 /****************************************************************************/
171 /** File/Save-as command. */
172 /****************************************************************************/
174 gl_ui_cmd_file_save_as (GtkAction *action,
177 gl_debug (DEBUG_COMMANDS, "START");
179 g_return_if_fail (action && GTK_IS_ACTION(action));
180 g_return_if_fail (window && GL_IS_WINDOW(window));
182 gl_file_save_as (GL_VIEW(window->view)->label, window);
184 gl_debug (DEBUG_COMMANDS, "END");
187 /****************************************************************************/
188 /** File/Print command. */
189 /****************************************************************************/
191 gl_ui_cmd_file_print (GtkAction *action,
196 gl_debug (DEBUG_COMMANDS, "START");
198 g_return_if_fail (action && GTK_IS_ACTION(action));
199 g_return_if_fail (window && GL_IS_WINDOW(window));
201 op = gl_print_op_new (GL_VIEW(window->view)->label);
203 gtk_print_operation_run (GTK_PRINT_OPERATION (op),
204 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
208 gl_debug (DEBUG_COMMANDS, "END");
211 /****************************************************************************/
212 /** File/Close command. */
213 /****************************************************************************/
215 gl_ui_cmd_file_close (GtkAction *action,
218 gl_debug (DEBUG_COMMANDS, "START");
220 g_return_if_fail (action && GTK_IS_ACTION(action));
221 g_return_if_fail (window && GL_IS_WINDOW(window));
223 gl_file_close (window);
225 gl_debug (DEBUG_COMMANDS, "END");
228 /****************************************************************************/
229 /** File/Quit command. */
230 /****************************************************************************/
232 gl_ui_cmd_file_quit (GtkAction *action,
235 gl_debug (DEBUG_COMMANDS, "START");
237 g_return_if_fail (action && GTK_IS_ACTION(action));
238 g_return_if_fail (window && GL_IS_WINDOW(window));
242 gl_debug (DEBUG_COMMANDS, "END");
246 /****************************************************************************/
247 /** Edit/Cut command. */
248 /****************************************************************************/
250 gl_ui_cmd_edit_cut (GtkAction *action,
253 gl_debug (DEBUG_COMMANDS, "START");
255 g_return_if_fail (action && GTK_IS_ACTION(action));
256 g_return_if_fail (window && GL_IS_WINDOW(window));
258 gl_view_cut (GL_VIEW(window->view));
260 gl_debug (DEBUG_COMMANDS, "END");
263 /****************************************************************************/
264 /** Edit/Copy command. */
265 /****************************************************************************/
267 gl_ui_cmd_edit_copy (GtkAction *action,
270 gl_debug (DEBUG_COMMANDS, "START");
272 g_return_if_fail (action && GTK_IS_ACTION(action));
273 g_return_if_fail (window && GL_IS_WINDOW(window));
275 gl_view_copy (GL_VIEW(window->view));
277 gl_debug (DEBUG_COMMANDS, "END");
280 /****************************************************************************/
281 /** Edit/Paste command. */
282 /****************************************************************************/
284 gl_ui_cmd_edit_paste (GtkAction *action,
287 gl_debug (DEBUG_COMMANDS, "START");
289 g_return_if_fail (action && GTK_IS_ACTION(action));
290 g_return_if_fail (window && GL_IS_WINDOW(window));
292 gl_view_paste (GL_VIEW(window->view));
294 gl_debug (DEBUG_COMMANDS, "END");
298 /****************************************************************************/
299 /** Edit/Delete command. */
300 /****************************************************************************/
302 gl_ui_cmd_edit_delete (GtkAction *action,
305 gl_debug (DEBUG_COMMANDS, "START");
307 g_return_if_fail (action && GTK_IS_ACTION(action));
308 g_return_if_fail (window && GL_IS_WINDOW(window));
310 gl_view_delete_selection (GL_VIEW(window->view));
312 gl_debug (DEBUG_COMMANDS, "END");
316 /****************************************************************************/
317 /** Edit/Select-all command. */
318 /****************************************************************************/
320 gl_ui_cmd_edit_select_all (GtkAction *action,
323 gl_debug (DEBUG_COMMANDS, "START");
325 g_return_if_fail (action && GTK_IS_ACTION(action));
326 g_return_if_fail (window && GL_IS_WINDOW(window));
328 gl_view_select_all (GL_VIEW(window->view));
330 gl_debug (DEBUG_COMMANDS, "END");
333 /****************************************************************************/
334 /** Edit/Unselect-all command. */
335 /****************************************************************************/
337 gl_ui_cmd_edit_unselect_all (GtkAction *action,
340 gl_debug (DEBUG_COMMANDS, "START");
342 g_return_if_fail (action && GTK_IS_ACTION(action));
343 g_return_if_fail (window && GL_IS_WINDOW(window));
345 gl_view_unselect_all (GL_VIEW(window->view));
347 gl_debug (DEBUG_COMMANDS, "END");
350 /****************************************************************************/
351 /** Edit/Preferences command. */
352 /****************************************************************************/
354 gl_ui_cmd_edit_preferences (GtkAction *action,
357 static GtkWidget *dlg = NULL;
359 gl_debug (DEBUG_COMMANDS, "START");
361 g_return_if_fail (action && GTK_IS_ACTION(action));
362 g_return_if_fail (window && GL_IS_WINDOW(window));
366 gtk_window_present (GTK_WINDOW (dlg));
367 gtk_window_set_transient_for (GTK_WINDOW (dlg),
372 dlg = gl_prefs_dialog_new (GTK_WINDOW(window));
374 g_signal_connect (G_OBJECT (dlg), "destroy",
375 G_CALLBACK (gtk_widget_destroyed), &dlg);
377 gtk_widget_show (dlg);
381 gl_debug (DEBUG_COMMANDS, "END");
384 /*****************************************************************************/
385 /** View/Property-bar-toggle command. */
386 /*****************************************************************************/
388 gl_ui_cmd_view_property_bar_toggle (GtkToggleAction *action,
393 gl_debug (DEBUG_COMMANDS, "START");
395 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
396 g_return_if_fail (window && GL_IS_WINDOW(window));
398 state = gtk_toggle_action_get_active (action);
400 gl_prefs->property_toolbar_visible = state;
402 gtk_widget_show (GTK_WIDGET (window->property_bar));
404 gtk_widget_hide (GTK_WIDGET (window->property_bar));
406 gl_prefs_model_save_settings (gl_prefs);
408 gl_debug (DEBUG_COMMANDS, "END");
411 /*****************************************************************************/
412 /** View/Property-bar-tooltips-toggle command. */
413 /*****************************************************************************/
415 gl_ui_cmd_view_property_bar_tips_toggle (GtkToggleAction *action,
420 gl_debug (DEBUG_COMMANDS, "START");
422 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
423 g_return_if_fail (window && GL_IS_WINDOW(window));
425 state = gtk_toggle_action_get_active (action);
427 gl_prefs->property_toolbar_view_tooltips = state;
428 gl_ui_property_bar_set_tooltips (window->property_bar, state);
429 gl_prefs_model_save_settings (gl_prefs);
431 gl_debug (DEBUG_COMMANDS, "END");
434 /*****************************************************************************/
435 /** View/Grid-toggle command. */
436 /*****************************************************************************/
438 gl_ui_cmd_view_grid_toggle (GtkToggleAction *action,
443 gl_debug (DEBUG_COMMANDS, "START");
445 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
446 g_return_if_fail (window && GL_IS_WINDOW(window));
448 state = gtk_toggle_action_get_active (action);
450 if (window->view != NULL)
453 gl_view_show_grid (GL_VIEW(window->view));
455 gl_view_hide_grid (GL_VIEW(window->view));
459 gl_prefs->grid_visible = state;
460 gl_prefs_model_save_settings (gl_prefs);
462 gl_debug (DEBUG_COMMANDS, "END");
465 /*****************************************************************************/
466 /** View/Markup-toggle command. */
467 /*****************************************************************************/
469 gl_ui_cmd_view_markup_toggle (GtkToggleAction *action,
474 gl_debug (DEBUG_COMMANDS, "START");
476 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
477 g_return_if_fail (window && GL_IS_WINDOW(window));
479 state = gtk_toggle_action_get_active (action);
481 if (window->view != NULL)
484 gl_view_show_markup (GL_VIEW(window->view));
486 gl_view_hide_markup (GL_VIEW(window->view));
490 gl_prefs->markup_visible = state;
491 gl_prefs_model_save_settings (gl_prefs);
493 gl_debug (DEBUG_COMMANDS, "END");
496 /*****************************************************************************/
497 /** View/Zoom-in command. */
498 /*****************************************************************************/
500 gl_ui_cmd_view_zoomin (GtkAction *action,
504 gl_debug (DEBUG_COMMANDS, "START");
506 g_return_if_fail (action && GTK_IS_ACTION(action));
507 g_return_if_fail (window && GL_IS_WINDOW(window));
509 if (window->view != NULL) {
510 gl_view_zoom_in (GL_VIEW(window->view));
513 gl_debug (DEBUG_COMMANDS, "END");
516 /*****************************************************************************/
517 /** View/Zoom-out command. */
518 /*****************************************************************************/
520 gl_ui_cmd_view_zoomout (GtkAction *action,
524 gl_debug (DEBUG_COMMANDS, "START");
526 g_return_if_fail (action && GTK_IS_ACTION(action));
527 g_return_if_fail (window && GL_IS_WINDOW(window));
529 if (window->view != NULL) {
530 gl_view_zoom_out (GL_VIEW(window->view));
533 gl_debug (DEBUG_COMMANDS, "END");
536 /*****************************************************************************/
537 /** View/Zoom-1:1 command. */
538 /*****************************************************************************/
540 gl_ui_cmd_view_zoom1to1 (GtkAction *action,
544 gl_debug (DEBUG_COMMANDS, "START");
546 g_return_if_fail (action && GTK_IS_ACTION(action));
547 g_return_if_fail (window && GL_IS_WINDOW(window));
549 if (window->view != NULL) {
550 gl_view_set_zoom (GL_VIEW(window->view), 1.0);
553 gl_debug (DEBUG_COMMANDS, "END");
556 /*****************************************************************************/
557 /** View/Zoom-to-fit command. */
558 /*****************************************************************************/
560 gl_ui_cmd_view_zoom_to_fit (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_zoom_to_fit (GL_VIEW(window->view));
573 gl_debug (DEBUG_COMMANDS, "END");
576 /*****************************************************************************/
577 /** Objects/Arrow-mode command. */
578 /*****************************************************************************/
580 gl_ui_cmd_objects_arrow_mode (GtkAction *action,
583 gl_debug (DEBUG_COMMANDS, "START");
585 g_return_if_fail (action && GTK_IS_ACTION(action));
586 g_return_if_fail (window && GL_IS_WINDOW(window));
588 if (window->view != NULL) {
589 gl_view_arrow_mode (GL_VIEW(window->view));
592 gl_debug (DEBUG_COMMANDS, "END");
595 /*****************************************************************************/
596 /** Objects/Create-text object command. */
597 /*****************************************************************************/
599 gl_ui_cmd_objects_create_text (GtkAction *action,
603 gl_debug (DEBUG_COMMANDS, "START");
605 g_return_if_fail (action && GTK_IS_ACTION(action));
606 g_return_if_fail (window && GL_IS_WINDOW(window));
608 if (window->view != NULL) {
609 gl_view_object_create_mode (GL_VIEW(window->view),
610 GL_LABEL_OBJECT_TEXT);
613 gl_debug (DEBUG_COMMANDS, "END");
616 /*****************************************************************************/
617 /** Objects/Create-box object command. */
618 /*****************************************************************************/
620 gl_ui_cmd_objects_create_box (GtkAction *action,
624 gl_debug (DEBUG_COMMANDS, "START");
626 g_return_if_fail (action && GTK_IS_ACTION(action));
627 g_return_if_fail (window && GL_IS_WINDOW(window));
629 if (window->view != NULL) {
630 gl_view_object_create_mode (GL_VIEW(window->view),
631 GL_LABEL_OBJECT_BOX);
634 gl_debug (DEBUG_COMMANDS, "END");
637 /*****************************************************************************/
638 /** Objects/Create-line object command. */
639 /*****************************************************************************/
641 gl_ui_cmd_objects_create_line (GtkAction *action,
645 gl_debug (DEBUG_COMMANDS, "START");
647 g_return_if_fail (action && GTK_IS_ACTION(action));
648 g_return_if_fail (window && GL_IS_WINDOW(window));
650 if (window->view != NULL) {
651 gl_view_object_create_mode (GL_VIEW(window->view),
652 GL_LABEL_OBJECT_LINE);
655 gl_debug (DEBUG_COMMANDS, "END");
658 /*****************************************************************************/
659 /** Objects/Create-ellipse object command. */
660 /*****************************************************************************/
662 gl_ui_cmd_objects_create_ellipse (GtkAction *action,
666 gl_debug (DEBUG_COMMANDS, "START");
668 g_return_if_fail (action && GTK_IS_ACTION(action));
669 g_return_if_fail (window && GL_IS_WINDOW(window));
671 if (window->view != NULL) {
672 gl_view_object_create_mode (GL_VIEW(window->view),
673 GL_LABEL_OBJECT_ELLIPSE);
676 gl_debug (DEBUG_COMMANDS, "END");
679 /*****************************************************************************/
680 /** Objects/Create-image object command. */
681 /*****************************************************************************/
683 gl_ui_cmd_objects_create_image (GtkAction *action,
687 gl_debug (DEBUG_COMMANDS, "START");
689 g_return_if_fail (action && GTK_IS_ACTION(action));
690 g_return_if_fail (window && GL_IS_WINDOW(window));
692 if (window->view != NULL) {
693 gl_view_object_create_mode (GL_VIEW(window->view),
694 GL_LABEL_OBJECT_IMAGE);
697 gl_debug (DEBUG_COMMANDS, "END");
700 /*****************************************************************************/
701 /** Objects/Create-barcode object command. */
702 /*****************************************************************************/
704 gl_ui_cmd_objects_create_barcode (GtkAction *action,
708 gl_debug (DEBUG_COMMANDS, "START");
710 g_return_if_fail (action && GTK_IS_ACTION(action));
711 g_return_if_fail (window && GL_IS_WINDOW(window));
713 if (window->view != NULL) {
714 gl_view_object_create_mode (GL_VIEW(window->view),
715 GL_LABEL_OBJECT_BARCODE);
718 gl_debug (DEBUG_COMMANDS, "END");
721 /*****************************************************************************/
722 /** Objects/Raise command. */
723 /*****************************************************************************/
725 gl_ui_cmd_objects_raise (GtkAction *action,
729 gl_debug (DEBUG_COMMANDS, "START");
731 g_return_if_fail (action && GTK_IS_ACTION(action));
732 g_return_if_fail (window && GL_IS_WINDOW(window));
734 if (window->view != NULL) {
735 gl_view_raise_selection (GL_VIEW(window->view));
738 gl_debug (DEBUG_COMMANDS, "END");
741 /*****************************************************************************/
742 /** Objects/Lower command. */
743 /*****************************************************************************/
745 gl_ui_cmd_objects_lower (GtkAction *action,
749 gl_debug (DEBUG_COMMANDS, "START");
751 g_return_if_fail (action && GTK_IS_ACTION(action));
752 g_return_if_fail (window && GL_IS_WINDOW(window));
754 if (window->view != NULL) {
755 gl_view_lower_selection (GL_VIEW(window->view));
758 gl_debug (DEBUG_COMMANDS, "END");
761 /*****************************************************************************/
762 /** Objects/Rotate-left-90-degrees command. */
763 /*****************************************************************************/
765 gl_ui_cmd_objects_rotate_left (GtkAction *action,
769 gl_debug (DEBUG_COMMANDS, "START");
771 g_return_if_fail (action && GTK_IS_ACTION(action));
772 g_return_if_fail (window && GL_IS_WINDOW(window));
774 if (window->view != NULL) {
775 gl_view_rotate_selection_left (GL_VIEW(window->view));
778 gl_debug (DEBUG_COMMANDS, "END");
781 /*****************************************************************************/
782 /** Objects/Rotate-right-90-degrees command. */
783 /*****************************************************************************/
785 gl_ui_cmd_objects_rotate_right (GtkAction *action,
789 gl_debug (DEBUG_COMMANDS, "START");
791 g_return_if_fail (action && GTK_IS_ACTION(action));
792 g_return_if_fail (window && GL_IS_WINDOW(window));
794 if (window->view != NULL) {
795 gl_view_rotate_selection_right (GL_VIEW(window->view));
798 gl_debug (DEBUG_COMMANDS, "END");
801 /*****************************************************************************/
802 /** Objects/Flip-horizontally command. */
803 /*****************************************************************************/
805 gl_ui_cmd_objects_flip_horiz (GtkAction *action,
809 gl_debug (DEBUG_COMMANDS, "START");
811 g_return_if_fail (action && GTK_IS_ACTION(action));
812 g_return_if_fail (window && GL_IS_WINDOW(window));
814 if (window->view != NULL) {
815 gl_view_flip_selection_horiz (GL_VIEW(window->view));
818 gl_debug (DEBUG_COMMANDS, "END");
821 /*****************************************************************************/
822 /** Objects/Flip-vertically command. */
823 /*****************************************************************************/
825 gl_ui_cmd_objects_flip_vert (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->view != NULL) {
835 gl_view_flip_selection_vert (GL_VIEW(window->view));
838 gl_debug (DEBUG_COMMANDS, "END");
841 /*****************************************************************************/
842 /** Objects/Align-left command. */
843 /*****************************************************************************/
845 gl_ui_cmd_objects_align_left (GtkAction *action,
849 gl_debug (DEBUG_COMMANDS, "START");
851 g_return_if_fail (action && GTK_IS_ACTION(action));
852 g_return_if_fail (window && GL_IS_WINDOW(window));
854 if (window->view != NULL) {
855 gl_view_align_selection_left (GL_VIEW(window->view));
858 gl_debug (DEBUG_COMMANDS, "END");
861 /*****************************************************************************/
862 /** Objects/Align-right command. */
863 /*****************************************************************************/
865 gl_ui_cmd_objects_align_right (GtkAction *action,
869 gl_debug (DEBUG_COMMANDS, "START");
871 g_return_if_fail (action && GTK_IS_ACTION(action));
872 g_return_if_fail (window && GL_IS_WINDOW(window));
874 if (window->view != NULL) {
875 gl_view_align_selection_right (GL_VIEW(window->view));
878 gl_debug (DEBUG_COMMANDS, "END");
881 /*****************************************************************************/
882 /** Objects/Align-horizontal-center command. */
883 /*****************************************************************************/
885 gl_ui_cmd_objects_align_hcenter (GtkAction *action,
889 gl_debug (DEBUG_COMMANDS, "START");
891 g_return_if_fail (action && GTK_IS_ACTION(action));
892 g_return_if_fail (window && GL_IS_WINDOW(window));
894 if (window->view != NULL) {
895 gl_view_align_selection_hcenter (GL_VIEW(window->view));
898 gl_debug (DEBUG_COMMANDS, "END");
901 /*****************************************************************************/
902 /** Objects/Align-top command. */
903 /*****************************************************************************/
905 gl_ui_cmd_objects_align_top (GtkAction *action,
909 gl_debug (DEBUG_COMMANDS, "START");
911 g_return_if_fail (action && GTK_IS_ACTION(action));
912 g_return_if_fail (window && GL_IS_WINDOW(window));
914 if (window->view != NULL) {
915 gl_view_align_selection_top (GL_VIEW(window->view));
918 gl_debug (DEBUG_COMMANDS, "END");
921 /*****************************************************************************/
922 /** Objects/Align-bottom command. */
923 /*****************************************************************************/
925 gl_ui_cmd_objects_align_bottom (GtkAction *action,
929 gl_debug (DEBUG_COMMANDS, "START");
931 g_return_if_fail (action && GTK_IS_ACTION(action));
932 g_return_if_fail (window && GL_IS_WINDOW(window));
934 if (window->view != NULL) {
935 gl_view_align_selection_bottom (GL_VIEW(window->view));
938 gl_debug (DEBUG_COMMANDS, "END");
941 /*****************************************************************************/
942 /** Objects/Align-vertical center command. */
943 /*****************************************************************************/
945 gl_ui_cmd_objects_align_vcenter (GtkAction *action,
949 gl_debug (DEBUG_COMMANDS, "START");
951 g_return_if_fail (action && GTK_IS_ACTION(action));
952 g_return_if_fail (window && GL_IS_WINDOW(window));
954 if (window->view != NULL) {
955 gl_view_align_selection_vcenter (GL_VIEW(window->view));
958 gl_debug (DEBUG_COMMANDS, "END");
961 /*****************************************************************************/
962 /** Objects/Center-horizontally command. */
963 /*****************************************************************************/
965 gl_ui_cmd_objects_center_horiz (GtkAction *action,
969 gl_debug (DEBUG_COMMANDS, "START");
971 g_return_if_fail (action && GTK_IS_ACTION(action));
972 g_return_if_fail (window && GL_IS_WINDOW(window));
974 if (window->view != NULL) {
975 gl_view_center_selection_horiz (GL_VIEW(window->view));
978 gl_debug (DEBUG_COMMANDS, "END");
981 /*****************************************************************************/
982 /** Objects/Center-vertically command. */
983 /*****************************************************************************/
985 gl_ui_cmd_objects_center_vert (GtkAction *action,
989 gl_debug (DEBUG_COMMANDS, "START");
991 g_return_if_fail (action && GTK_IS_ACTION(action));
992 g_return_if_fail (window && GL_IS_WINDOW(window));
994 if (window->view != NULL) {
995 gl_view_center_selection_vert (GL_VIEW(window->view));
998 gl_debug (DEBUG_COMMANDS, "END");
1001 /*****************************************************************************/
1002 /** Objects/Edit- merge-properties command. */
1003 /*****************************************************************************/
1005 gl_ui_cmd_objects_merge_properties (GtkAction *action,
1009 gl_debug (DEBUG_COMMANDS, "START");
1011 g_return_if_fail (action && GTK_IS_ACTION(action));
1012 g_return_if_fail (window && GL_IS_WINDOW(window));
1014 if (window->merge_dialog) {
1016 gtk_window_present (GTK_WINDOW(window->merge_dialog));
1017 gtk_window_set_transient_for (GTK_WINDOW (window->merge_dialog),
1018 GTK_WINDOW (window));
1022 window->merge_dialog =
1024 gl_merge_properties_dialog_new (GL_VIEW(window->view)->label,
1025 GTK_WINDOW(window)) );
1027 g_signal_connect (G_OBJECT(window->merge_dialog), "destroy",
1028 G_CALLBACK (gtk_widget_destroyed),
1029 &window->merge_dialog);
1031 gtk_widget_show (GTK_WIDGET (window->merge_dialog));
1035 gl_debug (DEBUG_COMMANDS, "END");
1038 /****************************************************************************/
1039 /** Help/Contents command. */
1040 /****************************************************************************/
1042 gl_ui_cmd_help_contents (GtkAction *action,
1045 GError *error = NULL;
1047 gl_debug (DEBUG_COMMANDS, "START");
1049 g_return_if_fail (action && GTK_IS_ACTION(action));
1050 g_return_if_fail (window && GL_IS_WINDOW(window));
1052 gnome_help_display_with_doc_id (NULL, NULL, "glabels.xml", NULL, &error);
1056 g_message (error->message);
1058 g_error_free (error);
1061 gl_debug (DEBUG_COMMANDS, "END");
1064 /*--------------------------------------------------------------------------*/
1065 /** Private: URL handler. */
1066 /*--------------------------------------------------------------------------*/
1068 activate_url (GtkAboutDialog *about,
1072 gl_debug (DEBUG_COMMANDS, "START");
1074 gnome_url_show (url, NULL);
1076 gl_debug (DEBUG_COMMANDS, "END");
1080 /****************************************************************************/
1081 /** Help/About command. */
1082 /****************************************************************************/
1084 gl_ui_cmd_help_about (GtkAction *action,
1087 static GtkWidget *about = NULL;
1089 GdkPixbuf *pixbuf = NULL;
1091 const gchar *authors[] = {
1094 _("Glabels includes contributions from:"),
1100 _("See the file AUTHORS for additional credits,"),
1101 _("or visit http://glabels.sourceforge.net/"),
1105 const gchar *artists[] = {
1111 const gchar *copy_text = "Copyright \xc2\xa9 2001-2005 Jim Evins";
1113 const gchar *about_text = _("A label and business card creation program.\n");
1115 const gchar *url = "http://glabels.sourceforge.net";
1117 const gchar *translator_credits = _("translator-credits");
1119 const gchar *license = _(
1120 "Glabels is free software; you can redistribute it and/or modify it\n"
1121 "under the terms of the GNU General Public License as published by\n"
1122 "the Free Software Foundation; either version 2 of the License, or\n"
1123 "(at your option) any later version.\n" "\n"
1124 "This program is distributed in the hope that it will be useful, but\n"
1125 "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
1126 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\n"
1127 "the GNU General Public License for more details.\n");
1129 gl_debug (DEBUG_COMMANDS, "START");
1131 g_return_if_fail (action && GTK_IS_ACTION(action));
1132 g_return_if_fail (window && GL_IS_WINDOW(window));
1137 gtk_window_present (GTK_WINDOW (about));
1138 gtk_window_set_transient_for (GTK_WINDOW (about),
1139 GTK_WINDOW (window));
1143 pixbuf = gdk_pixbuf_new_from_file ( LOGO_PIXMAP, NULL);
1145 gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
1147 about = gtk_about_dialog_new ();
1148 gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about), _("glabels"));
1149 gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about), VERSION);
1150 gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about), copy_text);
1151 gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG(about), about_text);
1152 gtk_about_dialog_set_website (GTK_ABOUT_DIALOG(about), url);
1153 gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about), pixbuf);
1155 gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG(about), authors);
1156 gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG(about), artists);
1157 gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about),
1158 translator_credits);
1159 gtk_about_dialog_set_license (GTK_ABOUT_DIALOG(about), license);
1161 gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);
1163 g_signal_connect (G_OBJECT (about), "response",
1164 G_CALLBACK (gtk_widget_destroy), NULL);
1165 g_signal_connect (G_OBJECT (about), "destroy",
1166 G_CALLBACK (gtk_widget_destroyed), &about);
1168 gtk_window_set_transient_for (GTK_WINDOW (about),
1169 GTK_WINDOW (window));
1171 gtk_window_present (GTK_WINDOW (about));
1174 g_object_unref (pixbuf);
1178 gl_debug (DEBUG_COMMANDS, "END");