Commit a03ad36c authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/Makefile.am app/actions/file-actions.c app/actions/file-commands.[ch]

2004-05-31  Sven Neumann  <sven@gimp.org>

	* app/Makefile.am
	* app/actions/file-actions.c
	* app/actions/file-commands.[ch]
	* app/gui/Makefile.am
	* app/gui/file-open-location-dialog.[ch]
	* app/widgets/gimphelp-ids.h
	* menus/image-menu.xml.in
	* menus/toolbox-menu.xml.in: added a rudimentary "Open Location"
	dialog.
parent caf4551b
2004-05-31 Sven Neumann <sven@gimp.org>
* app/Makefile.am
* app/actions/file-actions.c
* app/actions/file-commands.[ch]
* app/gui/Makefile.am
* app/gui/file-open-location-dialog.[ch]
* app/widgets/gimphelp-ids.h
* menus/image-menu.xml.in
* menus/toolbox-menu.xml.in: added a rudimentary "Open Location"
dialog.
2004-05-31 Sven Neumann <sven@gimp.org>
* plug-ins/common/mblur.c (mblur_zoom): push pixels outwards not
......
......@@ -92,6 +92,7 @@ gimp_2_1_LDFLAGS = \
-u $(SYMPREFIX)resize_dialog_new \
-u $(SYMPREFIX)stroke_dialog_new \
-u $(SYMPREFIX)file_open_dialog_show \
-u $(SYMPREFIX)file_open_location_dialog_show \
-u $(SYMPREFIX)file_save_dialog_show \
-u $(SYMPREFIX)color_notebook_new
......
......@@ -60,7 +60,7 @@ static GimpActionEntry file_actions[] =
{
{ "file-menu", NULL, N_("_File") },
{ "file-open-recent-menu", GTK_STOCK_OPEN,
{ "file-open-recent-menu", NULL,
N_("Open _Recent"), "", NULL },
{ "file-acquire-menu", NULL,
......@@ -76,6 +76,11 @@ static GimpActionEntry file_actions[] =
G_CALLBACK (file_open_from_image_cmd_callback),
GIMP_HELP_FILE_OPEN },
{ "file-open-location", NULL,
N_("_Open Location..."), NULL, NULL,
G_CALLBACK (file_open_location_cmd_callback),
GIMP_HELP_FILE_OPEN_LOCATION },
{ "file-save", GTK_STOCK_SAVE,
N_("_Save"), "<control>S", NULL,
G_CALLBACK (file_save_cmd_callback),
......
......@@ -46,6 +46,7 @@
#include "menus/menus.h"
#include "gui/file-open-dialog.h"
#include "gui/file-open-location-dialog.h"
#include "gui/file-save-dialog.h"
#include "actions.h"
......@@ -94,6 +95,18 @@ file_open_from_image_cmd_callback (GtkAction *action,
NULL, global_menu_factory, widget);
}
void
file_open_location_cmd_callback (GtkAction *action,
gpointer data)
{
Gimp *gimp;
GtkWidget *widget;
return_if_no_gimp (gimp, data);
return_if_no_widget (widget, data);
file_open_location_dialog_show (gimp, widget);
}
void
file_last_opened_cmd_callback (GtkAction *action,
gint value,
......
......@@ -22,6 +22,8 @@
void file_open_cmd_callback (GtkAction *action,
gpointer data);
void file_open_location_cmd_callback (GtkAction *action,
gpointer data);
void file_open_from_image_cmd_callback (GtkAction *action,
gpointer data);
void file_last_opened_cmd_callback (GtkAction *action,
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
* Copyright (C) 1997 Josh MacDonald
*
* This program 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
* (at your option) any later version.
*
* This program 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.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "file/file-open.h"
#include "file/file-utils.h"
#include "widgets/gimphelp-ids.h"
#include "file-open-location-dialog.h"
#include "gimp-intl.h"
static void file_open_location_response (GtkWidget *dialog,
gint response_id,
Gimp *gimp);
/* public functions */
void
file_open_location_dialog_show (Gimp *gimp,
GtkWidget *parent)
{
GtkWidget *dialog;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *entry;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (parent == NULL || GTK_IS_WIDGET (parent));
dialog = gimp_dialog_new (_("Open Location"),
"gimp-file-open-location",
parent, 0,
gimp_standard_help_func,
GIMP_HELP_FILE_OPEN_LOCATION,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (file_open_location_response),
gimp);
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox);
label = gtk_label_new (_("Enter location (URI):"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
gtk_widget_show (entry);
g_object_set_data (G_OBJECT (dialog), "location-entry", entry);
gtk_widget_show (dialog);
}
static void
file_open_location_response (GtkWidget *dialog,
gint response_id,
Gimp *gimp)
{
if (response_id == GTK_RESPONSE_OK)
{
GtkWidget *entry;
const gchar *text = NULL;
gtk_widget_set_sensitive (dialog, FALSE);
entry = g_object_get_data (G_OBJECT (dialog), "location-entry");
text = gtk_entry_get_text (GTK_ENTRY (entry));
if (text && strlen (text))
{
GimpImage *image;
gchar *uri;
GError *error = NULL;
GimpPDBStatusType status;
uri = file_utils_filename_to_uri (gimp->load_procs, text, NULL);
image = file_open_with_proc_and_display (gimp,
gimp_get_user_context (gimp),
uri, text, NULL,
&status, &error);
if (image == NULL && status != GIMP_PDB_CANCEL)
{
gchar *filename = file_utils_uri_to_utf8_filename (uri);
g_message (_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
g_free (filename);
}
g_free (uri);
}
}
gtk_widget_destroy (dialog);
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program 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
* (at your option) any later version.
*
* This program 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.
*/
#ifndef __FILE_OPEN_LOCATION_DIALOG_H__
#define __FILE_OPEN_LOCATION_DIALOG_H__
void file_open_location_dialog_show (Gimp *gimp,
GtkWidget *parent);
#endif /* __FILE_OPEN_LOCATION_DIALOG_H__ */
......@@ -21,6 +21,8 @@ dialogs_sources = \
file-new-dialog.h \
file-open-dialog.c \
file-open-dialog.h \
file-open-location-dialog.c \
file-open-location-dialog.h \
file-save-dialog.c \
file-save-dialog.h \
font-select.c \
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
* Copyright (C) 1997 Josh MacDonald
*
* This program 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
* (at your option) any later version.
*
* This program 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.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "file/file-open.h"
#include "file/file-utils.h"
#include "widgets/gimphelp-ids.h"
#include "file-open-location-dialog.h"
#include "gimp-intl.h"
static void file_open_location_response (GtkWidget *dialog,
gint response_id,
Gimp *gimp);
/* public functions */
void
file_open_location_dialog_show (Gimp *gimp,
GtkWidget *parent)
{
GtkWidget *dialog;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *entry;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (parent == NULL || GTK_IS_WIDGET (parent));
dialog = gimp_dialog_new (_("Open Location"),
"gimp-file-open-location",
parent, 0,
gimp_standard_help_func,
GIMP_HELP_FILE_OPEN_LOCATION,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (file_open_location_response),
gimp);
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox);
label = gtk_label_new (_("Enter location (URI):"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
gtk_widget_show (entry);
g_object_set_data (G_OBJECT (dialog), "location-entry", entry);
gtk_widget_show (dialog);
}
static void
file_open_location_response (GtkWidget *dialog,
gint response_id,
Gimp *gimp)
{
if (response_id == GTK_RESPONSE_OK)
{
GtkWidget *entry;
const gchar *text = NULL;
gtk_widget_set_sensitive (dialog, FALSE);
entry = g_object_get_data (G_OBJECT (dialog), "location-entry");
text = gtk_entry_get_text (GTK_ENTRY (entry));
if (text && strlen (text))
{
GimpImage *image;
gchar *uri;
GError *error = NULL;
GimpPDBStatusType status;
uri = file_utils_filename_to_uri (gimp->load_procs, text, NULL);
image = file_open_with_proc_and_display (gimp,
gimp_get_user_context (gimp),
uri, text, NULL,
&status, &error);
if (image == NULL && status != GIMP_PDB_CANCEL)
{
gchar *filename = file_utils_uri_to_utf8_filename (uri);
g_message (_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_clear_error (&error);
g_free (filename);
}
g_free (uri);
}
}
gtk_widget_destroy (dialog);
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program 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
* (at your option) any later version.
*
* This program 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.
*/
#ifndef __FILE_OPEN_LOCATION_DIALOG_H__
#define __FILE_OPEN_LOCATION_DIALOG_H__
void file_open_location_dialog_show (Gimp *gimp,
GtkWidget *parent);
#endif /* __FILE_OPEN_LOCATION_DIALOG_H__ */
......@@ -28,6 +28,7 @@
#define GIMP_HELP_FILE_NEW "gimp-file-new"
#define GIMP_HELP_FILE_NEW_CONFIRM "gimp-file-new-confirm"
#define GIMP_HELP_FILE_OPEN "gimp-file-open"
#define GIMP_HELP_FILE_OPEN_LOCATION "gimp-file-open-location"
#define GIMP_HELP_FILE_OPEN_BY_EXTENSION "gimp-file-open-by-extension"
#define GIMP_HELP_FILE_OPEN_XCF "gimp-file-open-xcf"
#define GIMP_HELP_FILE_OPEN_RECENT "gimp-file-open-recent"
......
......@@ -10,6 +10,7 @@
</placeholder>
<placeholder name="Open">
<menuitem action="file-open-from-image" />
<menuitem action="file-open-location" />
</placeholder>
<menu action="file-open-recent-menu" name="Open Recent">
<placeholder name="Files" />
......
......@@ -10,6 +10,7 @@
</placeholder>
<placeholder name="Open">
<menuitem action="file-open" />
<menuitem action="file-open-location" />
</placeholder>
<menu action="file-open-recent-menu" name="Open Recent">
<placeholder name="Files" />
......
2004-05-31 Sven Neumann <sven@gimp.org>
* POTFILES.in: updated.
2004-05-28 Andras Timar <timar@gnome.hu>
* hu.po: Updated Hungarian translation.
......
......@@ -140,6 +140,7 @@ app/gui/convert-dialog.c
app/gui/dialogs-constructors.c
app/gui/file-new-dialog.c
app/gui/file-open-dialog.c
app/gui/file-open-location-dialog.c
app/gui/file-save-dialog.c
app/gui/font-select.c
app/gui/gradient-select.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment