コード例 #1
0
ファイル: ui-commands.c プロジェクト: guyt101z/glabels
void
gl_ui_cmd_view_zoomout (GtkAction *action,
                        glWindow  *window)

{
        gl_debug (DEBUG_COMMANDS, "START");
        
        g_return_if_fail (action && GTK_IS_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        if (window->view != NULL) {
                gl_view_zoom_out (GL_VIEW(window->view));
        }

        gl_debug (DEBUG_COMMANDS, "END");
}
コード例 #2
0
ファイル: ui-commands.c プロジェクト: guyt101z/glabels
void
gl_ui_cmd_objects_center_vert (GtkAction *action,
                               glWindow  *window)

{
        gl_debug (DEBUG_COMMANDS, "START");
        
        g_return_if_fail (action && GTK_IS_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        if (window->label != NULL) {
                gl_label_center_selection_vert (window->label);
        }

        gl_debug (DEBUG_COMMANDS, "END");
}
コード例 #3
0
ファイル: ui-commands.c プロジェクト: guyt101z/glabels
void
gl_ui_cmd_file_template_designer (GtkAction *action,
                                  glWindow  *window)
{
        GtkWidget *dialog;

        gl_debug (DEBUG_COMMANDS, "START");

        g_return_if_fail (action && GTK_IS_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        dialog = gl_template_designer_new (GTK_WINDOW(window));

        gtk_widget_show (dialog);

        gl_debug (DEBUG_COMMANDS, "END");
}
コード例 #4
0
ファイル: ui-commands.c プロジェクト: guyt101z/glabels
void
gl_ui_cmd_objects_create_barcode (GtkAction *action,
                                  glWindow  *window)

{
        gl_debug (DEBUG_COMMANDS, "START");
        
        g_return_if_fail (action && GTK_IS_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        if (window->view != NULL) {
                gl_view_object_create_mode (GL_VIEW(window->view),
                                            GL_LABEL_OBJECT_BARCODE);
        }

        gl_debug (DEBUG_COMMANDS, "END");
}
コード例 #5
0
ファイル: ui.c プロジェクト: samlown/glabels
/*---------------------------------------------------------------------------*/
static void
menu_item_select_cb (GtkMenuItem *proxy,
		     glWindow    *window)
{
	GtkAction *action;
	char      *message;

	g_return_if_fail (window && GL_IS_WINDOW (window));
	g_return_if_fail (window->status_bar && GTK_IS_STATUSBAR (window->status_bar));

	action = g_object_get_data (G_OBJECT (proxy),  "gtk-action");
	g_return_if_fail (action != NULL);
	
	g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
	if (message)
	{
		gtk_statusbar_push (GTK_STATUSBAR (window->status_bar),
				    window->menu_tips_context_id, message);
		g_free (message);
	}
}
コード例 #6
0
ファイル: ui-commands.c プロジェクト: guyt101z/glabels
void
gl_ui_cmd_view_property_bar_toggle (GtkToggleAction *action,
                                    glWindow        *window)
{
        gboolean     state;

        gl_debug (DEBUG_COMMANDS, "START");

        g_return_if_fail (action && GTK_IS_TOGGLE_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        state =  gtk_toggle_action_get_active (action);

        gl_prefs_model_set_property_toolbar_visible (gl_prefs, state);
        if (state) {
                gtk_widget_show (GTK_WIDGET (window->property_bar));
        } else {
                gtk_widget_hide (GTK_WIDGET (window->property_bar));
        }

        gl_debug (DEBUG_COMMANDS, "END");
}
コード例 #7
0
ファイル: ui-commands.c プロジェクト: guyt101z/glabels
void 
gl_ui_cmd_help_about (GtkAction *action,
                      glWindow  *window)
{
        static GtkWidget *about = NULL;

        gchar            *pixbuf_filename;
        GdkPixbuf        *pixbuf = NULL;
        
        const gchar *authors[] = {
                "Jim Evins",
                " ",
                _("Glabels includes contributions from:"),
                "Mario Blättermann",
                "Robin Stuart",
                "Samuel Lown",
                "Frederic Ruaudel",
                "Wayne Schuller",
                "Emmanuel Pacaud",
                "Austin Henry",
                " ",
                _("See the file AUTHORS for additional credits,"),
                _("or visit http://glabels.org/"),
                NULL
        };

        const gchar *documenters[] = {
                "Jim Evins",
                "Mario Blättermann",
                NULL
        };
        
        const gchar *artists[] = {
                "Jim Evins",
                NULL
        };

        const gchar *copy_text = "Copyright \xc2\xa9 2001-2010 Jim Evins";

        const gchar *about_text = _("A label and business card creation program.\n");

        const gchar *url = "http://glabels.org";

        const gchar *translator_credits = _("translator-credits");

        const gchar *license = _(
                "gLabels is free software: you can redistribute it and/or modify\n"
                "it under the terms of the GNU General Public License as published by\n"
                "the Free Software Foundation, either version 3 of the License, or\n"
                "(at your option) any later version.\n"
                "\n"
                "gLabels is distributed in the hope that it will be useful,\n"
                "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
                "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
                "GNU General Public License for more details.\n");

        gl_debug (DEBUG_COMMANDS, "START");

        g_return_if_fail (action && GTK_IS_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        if (about != NULL)
        {

                gtk_window_present (GTK_WINDOW (about));
                gtk_window_set_transient_for (GTK_WINDOW (about),
                                              GTK_WINDOW (window));

        } else {
        
                pixbuf_filename = g_build_filename (GLABELS_DATA_DIR, "pixmaps", "glabels-logo.png", NULL);
                pixbuf = gdk_pixbuf_new_from_file (pixbuf_filename, NULL);
                g_free (pixbuf_filename);

                about = gtk_about_dialog_new ();
                gtk_window_set_title              (GTK_WINDOW(about),       _("About glabels"));
                gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG(about), "glabels");
                gtk_about_dialog_set_version      (GTK_ABOUT_DIALOG(about), VERSION);
                gtk_about_dialog_set_copyright    (GTK_ABOUT_DIALOG(about), copy_text);
                gtk_about_dialog_set_comments     (GTK_ABOUT_DIALOG(about), about_text);
                gtk_about_dialog_set_website      (GTK_ABOUT_DIALOG(about), url);
                gtk_about_dialog_set_logo         (GTK_ABOUT_DIALOG(about), pixbuf);

                gtk_about_dialog_set_authors            (GTK_ABOUT_DIALOG(about), authors);
                gtk_about_dialog_set_documenters        (GTK_ABOUT_DIALOG(about), documenters);
                gtk_about_dialog_set_artists            (GTK_ABOUT_DIALOG(about), artists);
                gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about), translator_credits);
                gtk_about_dialog_set_license            (GTK_ABOUT_DIALOG(about), license);
        
                gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);

                g_signal_connect (G_OBJECT (about), "response",
                                  G_CALLBACK (gtk_widget_destroy), NULL);
                g_signal_connect (G_OBJECT (about), "destroy",
                                  G_CALLBACK (gtk_widget_destroyed), &about);

                gtk_window_set_transient_for (GTK_WINDOW (about),
                                              GTK_WINDOW (window));

                gtk_window_present (GTK_WINDOW (about));

                if (pixbuf != NULL)
                        g_object_unref (pixbuf);

        }
        
        gl_debug (DEBUG_COMMANDS, "END");
}
コード例 #8
0
ファイル: ui.c プロジェクト: samlown/glabels
GtkUIManager *
gl_ui_new (glWindow *window)
{
	GtkUIManager            *ui;
	GtkActionGroup          *actions;
	GError                  *error = NULL;
	GtkWidget               *recent_menu;

	gl_debug (DEBUG_UI, "START");

	g_return_val_if_fail (window && GL_IS_WINDOW (window), NULL);

	gl_debug (DEBUG_UI, "window = %p", window);

	ui = gtk_ui_manager_new ();

	g_signal_connect (ui, "connect_proxy",
			  G_CALLBACK (connect_proxy_cb), window);
	g_signal_connect (ui, "disconnect_proxy",
			  G_CALLBACK (disconnect_proxy_cb), window);

	actions = gtk_action_group_new ("Actions");
        gtk_action_group_set_translation_domain (actions, NULL);
	gtk_action_group_add_actions (actions, entries, n_entries, GTK_WINDOW (window));
	gtk_action_group_add_toggle_actions (actions, 
					     toggle_entries, n_toggle_entries, 
					     window);
	gtk_action_group_add_toggle_actions (actions, 
					     ui_toggle_entries, n_ui_toggle_entries, 
					     ui);

	gtk_ui_manager_insert_action_group (ui, actions, 0);
	gtk_window_add_accel_group (GTK_WINDOW (window), gtk_ui_manager_get_accel_group (ui));

	gl_debug (DEBUG_UI, "Creating ui from string");
	if (!gtk_ui_manager_add_ui_from_string (ui, ui_info, strlen (ui_info), &error)) {
		g_message ("building menus failed: %s", error->message);
		g_error_free (error);
	}

	/* Set the toolbar styles according to prefs */
	set_app_main_toolbar_style (ui);
	set_app_drawing_toolbar_style (ui);
		
	/* Set view grid and markup visibility according to prefs */
	set_view_style (ui);
		
	/* add an Open Recents Submenu */
        recent_menu  = gl_recent_create_menu ();
	g_signal_connect (G_OBJECT (recent_menu), "item-activated",
			  G_CALLBACK (gl_ui_cmd_file_open_recent), window);
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget (ui, "/MenuBar/FileMenu/FileRecentsMenu")),
				   recent_menu);


        set_additional_properties (ui);

	gl_ui_util_set_verb_list_sensitive (ui, doc_verbs, FALSE);
	gl_ui_util_set_verb_list_sensitive (ui, paste_verbs, FALSE);

	gl_debug (DEBUG_UI, "END");

	return ui;
}