-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * ui-commands.c: GLabels UI commands module
+ * ui-commands.c
+ * Copyright (C) 2001-2009 Jim Evins <evins@snaught.com>.
*
- * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
+ * This file is part of gLabels.
*
- * This program is free software; you can redistribute it and/or modify
+ * gLabels is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * gLabels is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "ui-commands.h"
#include <glib/gi18n.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkaboutdialog.h>
-#include <libgnome/gnome-help.h>
-#include <libgnome/gnome-url.h>
-#include "recent-files/egg-recent-view.h"
-#include "recent-files/egg-recent-view-uimanager.h"
+#include <gtk/gtk.h>
#include "view.h"
#include "file.h"
#include "template-designer.h"
-#include "print-dialog.h"
+#include "print-op-dialog.h"
#include "prefs.h"
#include "prefs-dialog.h"
#include "recent.h"
#include "debug.h"
-#define LOGO_PIXMAP gnome_program_locate_file (NULL,\
- GNOME_FILE_DOMAIN_APP_PIXMAP,\
- "glabels/glabels-about-logo.png",\
- FALSE, NULL)
-\f
/****************************************************************************/
/** File/New command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** File/Properties command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** File/Template-Designer command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** File/Open command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** File/Open-Recent command. */
/****************************************************************************/
void
-gl_ui_cmd_file_open_recent (GtkAction *action,
- glWindow *window)
+gl_ui_cmd_file_open_recent (GtkRecentChooser *chooser,
+ glWindow *window)
{
- EggRecentViewUIManager *recent_view;
- EggRecentItem *item;
- gchar *utf8_filename;
+ GtkRecentInfo *item;
+ gchar *utf8_filename;
gl_debug (DEBUG_COMMANDS, "START");
- g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (chooser && GTK_IS_RECENT_CHOOSER(chooser));
g_return_if_fail (window && GL_IS_WINDOW(window));
- recent_view = g_object_get_data (G_OBJECT(window->ui), "recent-view");
- g_return_if_fail (recent_view && EGG_IS_RECENT_VIEW_UIMANAGER (recent_view));
+ item = gtk_recent_chooser_get_current_item (chooser);
+ if (!item)
+ return;
- item = egg_recent_view_uimanager_get_item (recent_view, action);
- utf8_filename = gl_recent_get_filename (item);
+ utf8_filename = gl_recent_get_utf8_filename (item);
+ gl_debug (DEBUG_COMMANDS, "Selected %s\n", utf8_filename);
gl_file_open_recent (utf8_filename, window);
+ gtk_recent_info_unref (item);
+
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** File/Save command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** File/Save-as command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** File/Print command. */
/****************************************************************************/
gl_ui_cmd_file_print (GtkAction *action,
glWindow *window)
{
+ glPrintOpDialog *op;
+ GtkPrintOperationResult result;
+
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->print_dialog) {
-
- gtk_window_present (GTK_WINDOW(window->print_dialog));
- gtk_window_set_transient_for (GTK_WINDOW (window->print_dialog),
- GTK_WINDOW (window));
-
- } else {
+ op = gl_print_op_dialog_new (GL_VIEW(window->view)->label);
- window->print_dialog =
- g_object_ref (
- gl_print_dialog_new (GL_VIEW(window->view)->label,
- GTK_WINDOW(window)) );
+ if (window->print_settings)
+ {
+ gl_print_op_set_settings (GL_PRINT_OP (op), window->print_settings);
+ }
- g_signal_connect (G_OBJECT(window->print_dialog), "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &window->print_dialog);
+ result = gtk_print_operation_run (GTK_PRINT_OPERATION (op),
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
+ GTK_WINDOW (window),
+ NULL);
- gtk_widget_show (GTK_WIDGET (window->print_dialog));
+ if ( result == GTK_PRINT_OPERATION_RESULT_APPLY )
+ {
+ gl_print_op_free_settings (window->print_settings);
+ window->print_settings = gl_print_op_get_settings (GL_PRINT_OP (op));
}
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** File/Close command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** File/Quit command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** Edit/Copy command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** Edit/Paste command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** Edit/Unselect-all command. */
/****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** Edit/Preferences command. */
/****************************************************************************/
gl_ui_cmd_edit_preferences (GtkAction *action,
glWindow *window)
{
- static GtkWidget *dlg = NULL;
+ static GtkWidget *dialog = NULL;
gl_debug (DEBUG_COMMANDS, "START");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (dlg != NULL)
+ if (dialog != NULL)
{
- gtk_window_present (GTK_WINDOW (dlg));
- gtk_window_set_transient_for (GTK_WINDOW (dlg),
+ gtk_window_present (GTK_WINDOW (dialog));
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW(window));
} else {
- dlg = gl_prefs_dialog_new (GTK_WINDOW(window));
+ dialog = gl_prefs_dialog_new (GTK_WINDOW(window));
- g_signal_connect (G_OBJECT (dlg), "destroy",
- G_CALLBACK (gtk_widget_destroyed), &dlg);
+ g_signal_connect (G_OBJECT (dialog), "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &dialog);
- gtk_widget_show (dlg);
+ gtk_widget_show (dialog);
}
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** View/Property-bar-toggle command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
-/*****************************************************************************/
-/** View/Property-bar-tooltips-toggle command. */
-/*****************************************************************************/
-void
-gl_ui_cmd_view_property_bar_tips_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->property_toolbar_view_tooltips = state;
- gl_ui_property_bar_set_tooltips (window->property_bar, state);
- gl_prefs_model_save_settings (gl_prefs);
-
- gl_debug (DEBUG_COMMANDS, "END");
-}
/*****************************************************************************/
/** View/Grid-toggle command. */
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** View/Markup-toggle command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** View/Zoom-in command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** View/Zoom-out command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** View/Zoom-1:1 command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** View/Zoom-to-fit command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Arrow-mode command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Create-text object command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Create-box object command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Create-line object command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Create-ellipse object command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Create-image object command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Create-barcode object command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Raise command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Lower command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Rotate-left-90-degrees command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Rotate-right-90-degrees command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Flip-horizontally command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Flip-vertically command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Align-left command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Align-right command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Align-horizontal-center command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Align-top command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Align-bottom command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Align-vertical center command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Center-horizontally command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Center-vertically command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/*****************************************************************************/
/** Objects/Edit- merge-properties command. */
/*****************************************************************************/
gl_debug (DEBUG_COMMANDS, "END");
}
+
/****************************************************************************/
/** Help/Contents command. */
/****************************************************************************/
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- gnome_help_display_with_doc_id (NULL, NULL, "glabels.xml", NULL, &error);
+ gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (window)),
+ "ghelp:glabels",
+ GDK_CURRENT_TIME,
+ &error);
if (error != NULL)
{
- g_message (error->message);
+ g_message ("%s", error->message);
g_error_free (error);
}
gl_debug (DEBUG_COMMANDS, "END");
}
-/*--------------------------------------------------------------------------*/
-/** Private: URL handler. */
-/*--------------------------------------------------------------------------*/
-static void
-activate_url (GtkAboutDialog *about,
- const gchar *url,
- gpointer data)
-{
- gl_debug (DEBUG_COMMANDS, "START");
-
- gnome_url_show (url, NULL);
-
- gl_debug (DEBUG_COMMANDS, "END");
-}
-
/****************************************************************************/
/** Help/About command. */
NULL
};
- const gchar *copy_text = "Copyright \xc2\xa9 2001-2005 Jim Evins";
+ const gchar *copy_text = "Copyright \xc2\xa9 2001-2009 Jim Evins";
const gchar *about_text = _("A label and business card creation program.\n");
const gchar *translator_credits = _("translator-credits");
const gchar *license = _(
- "Glabels is free software; you can redistribute it and/or modify it\n"
- "under the terms of the GNU General Public License as published by\n"
- "the Free Software Foundation; either version 2 of the License, or\n"
- "(at your option) any later version.\n" "\n"
- "This program is distributed in the hope that it will be useful, but\n"
- "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
- "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\n"
- "the GNU General Public License for more details.\n");
+ "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");
} else {
- pixbuf = gdk_pixbuf_new_from_file ( LOGO_PIXMAP, NULL);
-
- gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
+ pixbuf = gdk_pixbuf_new_from_file (GLABELS_PIXMAP_DIR "glabels-splash.png", NULL);
about = gtk_about_dialog_new ();
- gtk_about_dialog_set_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_artists (GTK_ABOUT_DIALOG(about), artists);
+ 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_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);
gl_debug (DEBUG_COMMANDS, "END");
}
+
+
+/*
+ * Local Variables: -- emacs
+ * mode: C -- emacs
+ * c-basic-offset: 8 -- emacs
+ * tab-width: 8 -- emacs
+ * indent-tabs-mode: nil -- emacs
+ * End: -- emacs
+ */