1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
4 * (GLABELS) Label and Business Card Creation program for GNOME
6 * ui-commands.c: GLabels UI commands module
8 * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include "ui-commands.h"
29 #include <glib/gi18n.h>
30 #include <gtk/gtkwindow.h>
31 #include <gtk/gtkaboutdialog.h>
32 #include <libgnome/gnome-help.h>
36 #include "template-designer.h"
39 #include "prefs-dialog.h"
45 /****************************************************************************/
46 /** File/New command. */
47 /****************************************************************************/
49 gl_ui_cmd_file_new (GtkAction *action,
52 gl_debug (DEBUG_COMMANDS, "START");
54 g_return_if_fail (action && GTK_IS_ACTION(action));
55 g_return_if_fail (window && GL_IS_WINDOW(window));
59 gl_debug (DEBUG_COMMANDS, "END");
62 /****************************************************************************/
63 /** File/Properties command. */
64 /****************************************************************************/
66 gl_ui_cmd_file_properties (GtkAction *action,
69 gl_debug (DEBUG_COMMANDS, "START");
71 g_return_if_fail (action && GTK_IS_ACTION(action));
72 g_return_if_fail (window && GL_IS_WINDOW(window));
74 gl_file_properties (GL_VIEW(window->view)->label, window);
76 gl_debug (DEBUG_COMMANDS, "END");
79 /****************************************************************************/
80 /** File/Template-Designer command. */
81 /****************************************************************************/
83 gl_ui_cmd_file_template_designer (GtkAction *action,
88 gl_debug (DEBUG_COMMANDS, "START");
90 g_return_if_fail (action && GTK_IS_ACTION(action));
91 g_return_if_fail (window && GL_IS_WINDOW(window));
93 dialog = gl_template_designer_new (GTK_WINDOW(window));
95 gtk_widget_show (dialog);
97 gl_debug (DEBUG_COMMANDS, "END");
100 /****************************************************************************/
101 /** File/Open command. */
102 /****************************************************************************/
104 gl_ui_cmd_file_open (GtkAction *action,
107 gl_debug (DEBUG_COMMANDS, "START");
109 g_return_if_fail (action && GTK_IS_ACTION(action));
110 g_return_if_fail (window && GL_IS_WINDOW(window));
112 gl_file_open (window);
114 gl_debug (DEBUG_COMMANDS, "END");
117 /****************************************************************************/
118 /** File/Open-Recent command. */
119 /****************************************************************************/
121 gl_ui_cmd_file_open_recent (GtkRecentChooser *chooser,
125 gchar *utf8_filename;
127 gl_debug (DEBUG_COMMANDS, "START");
129 g_return_if_fail (chooser && GTK_IS_RECENT_CHOOSER(chooser));
130 g_return_if_fail (window && GL_IS_WINDOW(window));
132 item = gtk_recent_chooser_get_current_item (chooser);
136 utf8_filename = gl_recent_get_utf8_filename (item);
138 gl_debug (DEBUG_COMMANDS, "Selected %s\n", utf8_filename);
140 gl_file_open_recent (utf8_filename, window);
143 gtk_recent_info_unref (item);
145 gl_debug (DEBUG_COMMANDS, "END");
148 /****************************************************************************/
149 /** File/Save command. */
150 /****************************************************************************/
152 gl_ui_cmd_file_save (GtkAction *action,
155 gl_debug (DEBUG_COMMANDS, "START");
157 g_return_if_fail (action && GTK_IS_ACTION(action));
158 g_return_if_fail (window && GL_IS_WINDOW(window));
160 gl_file_save (GL_VIEW(window->view)->label, window);
162 gl_debug (DEBUG_COMMANDS, "END");
165 /****************************************************************************/
166 /** File/Save-as command. */
167 /****************************************************************************/
169 gl_ui_cmd_file_save_as (GtkAction *action,
172 gl_debug (DEBUG_COMMANDS, "START");
174 g_return_if_fail (action && GTK_IS_ACTION(action));
175 g_return_if_fail (window && GL_IS_WINDOW(window));
177 gl_file_save_as (GL_VIEW(window->view)->label, window);
179 gl_debug (DEBUG_COMMANDS, "END");
182 /****************************************************************************/
183 /** File/Print command. */
184 /****************************************************************************/
186 gl_ui_cmd_file_print (GtkAction *action,
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_new (GL_VIEW(window->view)->label);
198 gtk_print_operation_run (GTK_PRINT_OPERATION (op),
199 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
203 gl_debug (DEBUG_COMMANDS, "END");
206 /****************************************************************************/
207 /** File/Close command. */
208 /****************************************************************************/
210 gl_ui_cmd_file_close (GtkAction *action,
213 gl_debug (DEBUG_COMMANDS, "START");
215 g_return_if_fail (action && GTK_IS_ACTION(action));
216 g_return_if_fail (window && GL_IS_WINDOW(window));
218 gl_file_close (window);
220 gl_debug (DEBUG_COMMANDS, "END");
223 /****************************************************************************/
224 /** File/Quit command. */
225 /****************************************************************************/
227 gl_ui_cmd_file_quit (GtkAction *action,
230 gl_debug (DEBUG_COMMANDS, "START");
232 g_return_if_fail (action && GTK_IS_ACTION(action));
233 g_return_if_fail (window && GL_IS_WINDOW(window));
237 gl_debug (DEBUG_COMMANDS, "END");
241 /****************************************************************************/
242 /** Edit/Cut command. */
243 /****************************************************************************/
245 gl_ui_cmd_edit_cut (GtkAction *action,
248 gl_debug (DEBUG_COMMANDS, "START");
250 g_return_if_fail (action && GTK_IS_ACTION(action));
251 g_return_if_fail (window && GL_IS_WINDOW(window));
253 gl_view_cut (GL_VIEW(window->view));
255 gl_debug (DEBUG_COMMANDS, "END");
258 /****************************************************************************/
259 /** Edit/Copy command. */
260 /****************************************************************************/
262 gl_ui_cmd_edit_copy (GtkAction *action,
265 gl_debug (DEBUG_COMMANDS, "START");
267 g_return_if_fail (action && GTK_IS_ACTION(action));
268 g_return_if_fail (window && GL_IS_WINDOW(window));
270 gl_view_copy (GL_VIEW(window->view));
272 gl_debug (DEBUG_COMMANDS, "END");
275 /****************************************************************************/
276 /** Edit/Paste command. */
277 /****************************************************************************/
279 gl_ui_cmd_edit_paste (GtkAction *action,
282 gl_debug (DEBUG_COMMANDS, "START");
284 g_return_if_fail (action && GTK_IS_ACTION(action));
285 g_return_if_fail (window && GL_IS_WINDOW(window));
287 gl_view_paste (GL_VIEW(window->view));
289 gl_debug (DEBUG_COMMANDS, "END");
293 /****************************************************************************/
294 /** Edit/Delete command. */
295 /****************************************************************************/
297 gl_ui_cmd_edit_delete (GtkAction *action,
300 gl_debug (DEBUG_COMMANDS, "START");
302 g_return_if_fail (action && GTK_IS_ACTION(action));
303 g_return_if_fail (window && GL_IS_WINDOW(window));
305 gl_view_delete_selection (GL_VIEW(window->view));
307 gl_debug (DEBUG_COMMANDS, "END");
311 /****************************************************************************/
312 /** Edit/Select-all command. */
313 /****************************************************************************/
315 gl_ui_cmd_edit_select_all (GtkAction *action,
318 gl_debug (DEBUG_COMMANDS, "START");
320 g_return_if_fail (action && GTK_IS_ACTION(action));
321 g_return_if_fail (window && GL_IS_WINDOW(window));
323 gl_view_select_all (GL_VIEW(window->view));
325 gl_debug (DEBUG_COMMANDS, "END");
328 /****************************************************************************/
329 /** Edit/Unselect-all command. */
330 /****************************************************************************/
332 gl_ui_cmd_edit_unselect_all (GtkAction *action,
335 gl_debug (DEBUG_COMMANDS, "START");
337 g_return_if_fail (action && GTK_IS_ACTION(action));
338 g_return_if_fail (window && GL_IS_WINDOW(window));
340 gl_view_unselect_all (GL_VIEW(window->view));
342 gl_debug (DEBUG_COMMANDS, "END");
345 /****************************************************************************/
346 /** Edit/Preferences command. */
347 /****************************************************************************/
349 gl_ui_cmd_edit_preferences (GtkAction *action,
352 static GtkWidget *dialog = NULL;
354 gl_debug (DEBUG_COMMANDS, "START");
356 g_return_if_fail (action && GTK_IS_ACTION(action));
357 g_return_if_fail (window && GL_IS_WINDOW(window));
361 gtk_window_present (GTK_WINDOW (dialog));
362 gtk_window_set_transient_for (GTK_WINDOW (dialog),
367 dialog = gl_prefs_dialog_new (GTK_WINDOW(window));
369 g_signal_connect (G_OBJECT (dialog), "destroy",
370 G_CALLBACK (gtk_widget_destroyed), &dialog);
372 gtk_widget_show (dialog);
376 gl_debug (DEBUG_COMMANDS, "END");
379 /*****************************************************************************/
380 /** View/Property-bar-toggle command. */
381 /*****************************************************************************/
383 gl_ui_cmd_view_property_bar_toggle (GtkToggleAction *action,
388 gl_debug (DEBUG_COMMANDS, "START");
390 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
391 g_return_if_fail (window && GL_IS_WINDOW(window));
393 state = gtk_toggle_action_get_active (action);
395 gl_prefs->property_toolbar_visible = state;
397 gtk_widget_show (GTK_WIDGET (window->property_bar));
399 gtk_widget_hide (GTK_WIDGET (window->property_bar));
401 gl_prefs_model_save_settings (gl_prefs);
403 gl_debug (DEBUG_COMMANDS, "END");
406 /*****************************************************************************/
407 /** View/Property-bar-tooltips-toggle command. */
408 /*****************************************************************************/
410 gl_ui_cmd_view_property_bar_tips_toggle (GtkToggleAction *action,
415 gl_debug (DEBUG_COMMANDS, "START");
417 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
418 g_return_if_fail (window && GL_IS_WINDOW(window));
420 state = gtk_toggle_action_get_active (action);
422 gl_prefs->property_toolbar_view_tooltips = state;
423 gl_ui_property_bar_set_tooltips (window->property_bar, state);
424 gl_prefs_model_save_settings (gl_prefs);
426 gl_debug (DEBUG_COMMANDS, "END");
429 /*****************************************************************************/
430 /** View/Grid-toggle command. */
431 /*****************************************************************************/
433 gl_ui_cmd_view_grid_toggle (GtkToggleAction *action,
438 gl_debug (DEBUG_COMMANDS, "START");
440 g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
441 g_return_if_fail (window && GL_IS_WINDOW(window));
443 state = gtk_toggle_action_get_active (action);
445 if (window->view != NULL)
448 gl_view_show_grid (GL_VIEW(window->view));
450 gl_view_hide_grid (GL_VIEW(window->view));
454 gl_prefs->grid_visible = state;
455 gl_prefs_model_save_settings (gl_prefs);
457 gl_debug (DEBUG_COMMANDS, "END");
460 /*****************************************************************************/
461 /** View/Markup-toggle command. */
462 /*****************************************************************************/
464 gl_ui_cmd_view_markup_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_markup (GL_VIEW(window->view));
481 gl_view_hide_markup (GL_VIEW(window->view));
485 gl_prefs->markup_visible = state;
486 gl_prefs_model_save_settings (gl_prefs);
488 gl_debug (DEBUG_COMMANDS, "END");
491 /*****************************************************************************/
492 /** View/Zoom-in command. */
493 /*****************************************************************************/
495 gl_ui_cmd_view_zoomin (GtkAction *action,
499 gl_debug (DEBUG_COMMANDS, "START");
501 g_return_if_fail (action && GTK_IS_ACTION(action));
502 g_return_if_fail (window && GL_IS_WINDOW(window));
504 if (window->view != NULL) {
505 gl_view_zoom_in (GL_VIEW(window->view));
508 gl_debug (DEBUG_COMMANDS, "END");
511 /*****************************************************************************/
512 /** View/Zoom-out command. */
513 /*****************************************************************************/
515 gl_ui_cmd_view_zoomout (GtkAction *action,
519 gl_debug (DEBUG_COMMANDS, "START");
521 g_return_if_fail (action && GTK_IS_ACTION(action));
522 g_return_if_fail (window && GL_IS_WINDOW(window));
524 if (window->view != NULL) {
525 gl_view_zoom_out (GL_VIEW(window->view));
528 gl_debug (DEBUG_COMMANDS, "END");
531 /*****************************************************************************/
532 /** View/Zoom-1:1 command. */
533 /*****************************************************************************/
535 gl_ui_cmd_view_zoom1to1 (GtkAction *action,
539 gl_debug (DEBUG_COMMANDS, "START");
541 g_return_if_fail (action && GTK_IS_ACTION(action));
542 g_return_if_fail (window && GL_IS_WINDOW(window));
544 if (window->view != NULL) {
545 gl_view_set_zoom (GL_VIEW(window->view), 1.0);
548 gl_debug (DEBUG_COMMANDS, "END");
551 /*****************************************************************************/
552 /** View/Zoom-to-fit command. */
553 /*****************************************************************************/
555 gl_ui_cmd_view_zoom_to_fit (GtkAction *action,
559 gl_debug (DEBUG_COMMANDS, "START");
561 g_return_if_fail (action && GTK_IS_ACTION(action));
562 g_return_if_fail (window && GL_IS_WINDOW(window));
564 if (window->view != NULL) {
565 gl_view_zoom_to_fit (GL_VIEW(window->view));
568 gl_debug (DEBUG_COMMANDS, "END");
571 /*****************************************************************************/
572 /** Objects/Arrow-mode command. */
573 /*****************************************************************************/
575 gl_ui_cmd_objects_arrow_mode (GtkAction *action,
578 gl_debug (DEBUG_COMMANDS, "START");
580 g_return_if_fail (action && GTK_IS_ACTION(action));
581 g_return_if_fail (window && GL_IS_WINDOW(window));
583 if (window->view != NULL) {
584 gl_view_arrow_mode (GL_VIEW(window->view));
587 gl_debug (DEBUG_COMMANDS, "END");
590 /*****************************************************************************/
591 /** Objects/Create-text object command. */
592 /*****************************************************************************/
594 gl_ui_cmd_objects_create_text (GtkAction *action,
598 gl_debug (DEBUG_COMMANDS, "START");
600 g_return_if_fail (action && GTK_IS_ACTION(action));
601 g_return_if_fail (window && GL_IS_WINDOW(window));
603 if (window->view != NULL) {
604 gl_view_object_create_mode (GL_VIEW(window->view),
605 GL_LABEL_OBJECT_TEXT);
608 gl_debug (DEBUG_COMMANDS, "END");
611 /*****************************************************************************/
612 /** Objects/Create-box object command. */
613 /*****************************************************************************/
615 gl_ui_cmd_objects_create_box (GtkAction *action,
619 gl_debug (DEBUG_COMMANDS, "START");
621 g_return_if_fail (action && GTK_IS_ACTION(action));
622 g_return_if_fail (window && GL_IS_WINDOW(window));
624 if (window->view != NULL) {
625 gl_view_object_create_mode (GL_VIEW(window->view),
626 GL_LABEL_OBJECT_BOX);
629 gl_debug (DEBUG_COMMANDS, "END");
632 /*****************************************************************************/
633 /** Objects/Create-line object command. */
634 /*****************************************************************************/
636 gl_ui_cmd_objects_create_line (GtkAction *action,
640 gl_debug (DEBUG_COMMANDS, "START");
642 g_return_if_fail (action && GTK_IS_ACTION(action));
643 g_return_if_fail (window && GL_IS_WINDOW(window));
645 if (window->view != NULL) {
646 gl_view_object_create_mode (GL_VIEW(window->view),
647 GL_LABEL_OBJECT_LINE);
650 gl_debug (DEBUG_COMMANDS, "END");
653 /*****************************************************************************/
654 /** Objects/Create-ellipse object command. */
655 /*****************************************************************************/
657 gl_ui_cmd_objects_create_ellipse (GtkAction *action,
661 gl_debug (DEBUG_COMMANDS, "START");
663 g_return_if_fail (action && GTK_IS_ACTION(action));
664 g_return_if_fail (window && GL_IS_WINDOW(window));
666 if (window->view != NULL) {
667 gl_view_object_create_mode (GL_VIEW(window->view),
668 GL_LABEL_OBJECT_ELLIPSE);
671 gl_debug (DEBUG_COMMANDS, "END");
674 /*****************************************************************************/
675 /** Objects/Create-image object command. */
676 /*****************************************************************************/
678 gl_ui_cmd_objects_create_image (GtkAction *action,
682 gl_debug (DEBUG_COMMANDS, "START");
684 g_return_if_fail (action && GTK_IS_ACTION(action));
685 g_return_if_fail (window && GL_IS_WINDOW(window));
687 if (window->view != NULL) {
688 gl_view_object_create_mode (GL_VIEW(window->view),
689 GL_LABEL_OBJECT_IMAGE);
692 gl_debug (DEBUG_COMMANDS, "END");
695 /*****************************************************************************/
696 /** Objects/Create-barcode object command. */
697 /*****************************************************************************/
699 gl_ui_cmd_objects_create_barcode (GtkAction *action,
703 gl_debug (DEBUG_COMMANDS, "START");
705 g_return_if_fail (action && GTK_IS_ACTION(action));
706 g_return_if_fail (window && GL_IS_WINDOW(window));
708 if (window->view != NULL) {
709 gl_view_object_create_mode (GL_VIEW(window->view),
710 GL_LABEL_OBJECT_BARCODE);
713 gl_debug (DEBUG_COMMANDS, "END");
716 /*****************************************************************************/
717 /** Objects/Raise command. */
718 /*****************************************************************************/
720 gl_ui_cmd_objects_raise (GtkAction *action,
724 gl_debug (DEBUG_COMMANDS, "START");
726 g_return_if_fail (action && GTK_IS_ACTION(action));
727 g_return_if_fail (window && GL_IS_WINDOW(window));
729 if (window->view != NULL) {
730 gl_view_raise_selection (GL_VIEW(window->view));
733 gl_debug (DEBUG_COMMANDS, "END");
736 /*****************************************************************************/
737 /** Objects/Lower command. */
738 /*****************************************************************************/
740 gl_ui_cmd_objects_lower (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_lower_selection (GL_VIEW(window->view));
753 gl_debug (DEBUG_COMMANDS, "END");
756 /*****************************************************************************/
757 /** Objects/Rotate-left-90-degrees command. */
758 /*****************************************************************************/
760 gl_ui_cmd_objects_rotate_left (GtkAction *action,
764 gl_debug (DEBUG_COMMANDS, "START");
766 g_return_if_fail (action && GTK_IS_ACTION(action));
767 g_return_if_fail (window && GL_IS_WINDOW(window));
769 if (window->view != NULL) {
770 gl_view_rotate_selection_left (GL_VIEW(window->view));
773 gl_debug (DEBUG_COMMANDS, "END");
776 /*****************************************************************************/
777 /** Objects/Rotate-right-90-degrees command. */
778 /*****************************************************************************/
780 gl_ui_cmd_objects_rotate_right (GtkAction *action,
784 gl_debug (DEBUG_COMMANDS, "START");
786 g_return_if_fail (action && GTK_IS_ACTION(action));
787 g_return_if_fail (window && GL_IS_WINDOW(window));
789 if (window->view != NULL) {
790 gl_view_rotate_selection_right (GL_VIEW(window->view));
793 gl_debug (DEBUG_COMMANDS, "END");
796 /*****************************************************************************/
797 /** Objects/Flip-horizontally command. */
798 /*****************************************************************************/
800 gl_ui_cmd_objects_flip_horiz (GtkAction *action,
804 gl_debug (DEBUG_COMMANDS, "START");
806 g_return_if_fail (action && GTK_IS_ACTION(action));
807 g_return_if_fail (window && GL_IS_WINDOW(window));
809 if (window->view != NULL) {
810 gl_view_flip_selection_horiz (GL_VIEW(window->view));
813 gl_debug (DEBUG_COMMANDS, "END");
816 /*****************************************************************************/
817 /** Objects/Flip-vertically command. */
818 /*****************************************************************************/
820 gl_ui_cmd_objects_flip_vert (GtkAction *action,
824 gl_debug (DEBUG_COMMANDS, "START");
826 g_return_if_fail (action && GTK_IS_ACTION(action));
827 g_return_if_fail (window && GL_IS_WINDOW(window));
829 if (window->view != NULL) {
830 gl_view_flip_selection_vert (GL_VIEW(window->view));
833 gl_debug (DEBUG_COMMANDS, "END");
836 /*****************************************************************************/
837 /** Objects/Align-left command. */
838 /*****************************************************************************/
840 gl_ui_cmd_objects_align_left (GtkAction *action,
844 gl_debug (DEBUG_COMMANDS, "START");
846 g_return_if_fail (action && GTK_IS_ACTION(action));
847 g_return_if_fail (window && GL_IS_WINDOW(window));
849 if (window->view != NULL) {
850 gl_view_align_selection_left (GL_VIEW(window->view));
853 gl_debug (DEBUG_COMMANDS, "END");
856 /*****************************************************************************/
857 /** Objects/Align-right command. */
858 /*****************************************************************************/
860 gl_ui_cmd_objects_align_right (GtkAction *action,
864 gl_debug (DEBUG_COMMANDS, "START");
866 g_return_if_fail (action && GTK_IS_ACTION(action));
867 g_return_if_fail (window && GL_IS_WINDOW(window));
869 if (window->view != NULL) {
870 gl_view_align_selection_right (GL_VIEW(window->view));
873 gl_debug (DEBUG_COMMANDS, "END");
876 /*****************************************************************************/
877 /** Objects/Align-horizontal-center command. */
878 /*****************************************************************************/
880 gl_ui_cmd_objects_align_hcenter (GtkAction *action,
884 gl_debug (DEBUG_COMMANDS, "START");
886 g_return_if_fail (action && GTK_IS_ACTION(action));
887 g_return_if_fail (window && GL_IS_WINDOW(window));
889 if (window->view != NULL) {
890 gl_view_align_selection_hcenter (GL_VIEW(window->view));
893 gl_debug (DEBUG_COMMANDS, "END");
896 /*****************************************************************************/
897 /** Objects/Align-top command. */
898 /*****************************************************************************/
900 gl_ui_cmd_objects_align_top (GtkAction *action,
904 gl_debug (DEBUG_COMMANDS, "START");
906 g_return_if_fail (action && GTK_IS_ACTION(action));
907 g_return_if_fail (window && GL_IS_WINDOW(window));
909 if (window->view != NULL) {
910 gl_view_align_selection_top (GL_VIEW(window->view));
913 gl_debug (DEBUG_COMMANDS, "END");
916 /*****************************************************************************/
917 /** Objects/Align-bottom command. */
918 /*****************************************************************************/
920 gl_ui_cmd_objects_align_bottom (GtkAction *action,
924 gl_debug (DEBUG_COMMANDS, "START");
926 g_return_if_fail (action && GTK_IS_ACTION(action));
927 g_return_if_fail (window && GL_IS_WINDOW(window));
929 if (window->view != NULL) {
930 gl_view_align_selection_bottom (GL_VIEW(window->view));
933 gl_debug (DEBUG_COMMANDS, "END");
936 /*****************************************************************************/
937 /** Objects/Align-vertical center command. */
938 /*****************************************************************************/
940 gl_ui_cmd_objects_align_vcenter (GtkAction *action,
944 gl_debug (DEBUG_COMMANDS, "START");
946 g_return_if_fail (action && GTK_IS_ACTION(action));
947 g_return_if_fail (window && GL_IS_WINDOW(window));
949 if (window->view != NULL) {
950 gl_view_align_selection_vcenter (GL_VIEW(window->view));
953 gl_debug (DEBUG_COMMANDS, "END");
956 /*****************************************************************************/
957 /** Objects/Center-horizontally command. */
958 /*****************************************************************************/
960 gl_ui_cmd_objects_center_horiz (GtkAction *action,
964 gl_debug (DEBUG_COMMANDS, "START");
966 g_return_if_fail (action && GTK_IS_ACTION(action));
967 g_return_if_fail (window && GL_IS_WINDOW(window));
969 if (window->view != NULL) {
970 gl_view_center_selection_horiz (GL_VIEW(window->view));
973 gl_debug (DEBUG_COMMANDS, "END");
976 /*****************************************************************************/
977 /** Objects/Center-vertically command. */
978 /*****************************************************************************/
980 gl_ui_cmd_objects_center_vert (GtkAction *action,
984 gl_debug (DEBUG_COMMANDS, "START");
986 g_return_if_fail (action && GTK_IS_ACTION(action));
987 g_return_if_fail (window && GL_IS_WINDOW(window));
989 if (window->view != NULL) {
990 gl_view_center_selection_vert (GL_VIEW(window->view));
993 gl_debug (DEBUG_COMMANDS, "END");
996 /*****************************************************************************/
997 /** Objects/Edit- merge-properties command. */
998 /*****************************************************************************/
1000 gl_ui_cmd_objects_merge_properties (GtkAction *action,
1004 gl_debug (DEBUG_COMMANDS, "START");
1006 g_return_if_fail (action && GTK_IS_ACTION(action));
1007 g_return_if_fail (window && GL_IS_WINDOW(window));
1009 if (window->merge_dialog) {
1011 gtk_window_present (GTK_WINDOW(window->merge_dialog));
1012 gtk_window_set_transient_for (GTK_WINDOW (window->merge_dialog),
1013 GTK_WINDOW (window));
1017 window->merge_dialog =
1019 gl_merge_properties_dialog_new (GL_VIEW(window->view)->label,
1020 GTK_WINDOW(window)) );
1022 g_signal_connect (G_OBJECT(window->merge_dialog), "destroy",
1023 G_CALLBACK (gtk_widget_destroyed),
1024 &window->merge_dialog);
1026 gtk_widget_show (GTK_WIDGET (window->merge_dialog));
1030 gl_debug (DEBUG_COMMANDS, "END");
1033 /****************************************************************************/
1034 /** Help/Contents command. */
1035 /****************************************************************************/
1037 gl_ui_cmd_help_contents (GtkAction *action,
1040 GError *error = NULL;
1042 gl_debug (DEBUG_COMMANDS, "START");
1044 g_return_if_fail (action && GTK_IS_ACTION(action));
1045 g_return_if_fail (window && GL_IS_WINDOW(window));
1047 gnome_help_display_with_doc_id (NULL, NULL, "glabels.xml", NULL, &error);
1051 g_message (error->message);
1053 g_error_free (error);
1056 gl_debug (DEBUG_COMMANDS, "END");
1060 /****************************************************************************/
1061 /** Help/About command. */
1062 /****************************************************************************/
1064 gl_ui_cmd_help_about (GtkAction *action,
1067 static GtkWidget *about = NULL;
1069 GdkPixbuf *pixbuf = NULL;
1071 const gchar *authors[] = {
1074 _("Glabels includes contributions from:"),
1080 _("See the file AUTHORS for additional credits,"),
1081 _("or visit http://glabels.sourceforge.net/"),
1085 const gchar *artists[] = {
1091 const gchar *copy_text = "Copyright \xc2\xa9 2001-2005 Jim Evins";
1093 const gchar *about_text = _("A label and business card creation program.\n");
1095 const gchar *url = "http://glabels.sourceforge.net";
1097 const gchar *translator_credits = _("translator-credits");
1099 const gchar *license = _(
1100 "Glabels is free software; you can redistribute it and/or modify it\n"
1101 "under the terms of the GNU General Public License as published by\n"
1102 "the Free Software Foundation; either version 2 of the License, or\n"
1103 "(at your option) any later version.\n" "\n"
1104 "This program is distributed in the hope that it will be useful, but\n"
1105 "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
1106 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\n"
1107 "the GNU General Public License for more details.\n");
1109 gl_debug (DEBUG_COMMANDS, "START");
1111 g_return_if_fail (action && GTK_IS_ACTION(action));
1112 g_return_if_fail (window && GL_IS_WINDOW(window));
1117 gtk_window_present (GTK_WINDOW (about));
1118 gtk_window_set_transient_for (GTK_WINDOW (about),
1119 GTK_WINDOW (window));
1123 pixbuf = gdk_pixbuf_new_from_file (GLABELS_PIXMAP_DIR "glabels-splash.png", NULL);
1125 about = gtk_about_dialog_new ();
1126 gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about), _("glabels"));
1127 gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about), VERSION);
1128 gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about), copy_text);
1129 gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG(about), about_text);
1130 gtk_about_dialog_set_website (GTK_ABOUT_DIALOG(about), url);
1131 gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about), pixbuf);
1133 gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG(about), authors);
1134 gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG(about), artists);
1135 gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about),
1136 translator_credits);
1137 gtk_about_dialog_set_license (GTK_ABOUT_DIALOG(about), license);
1139 gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);
1141 g_signal_connect (G_OBJECT (about), "response",
1142 G_CALLBACK (gtk_widget_destroy), NULL);
1143 g_signal_connect (G_OBJECT (about), "destroy",
1144 G_CALLBACK (gtk_widget_destroyed), &about);
1146 gtk_window_set_transient_for (GTK_WINDOW (about),
1147 GTK_WINDOW (window));
1149 gtk_window_present (GTK_WINDOW (about));
1152 g_object_unref (pixbuf);
1156 gl_debug (DEBUG_COMMANDS, "END");