mirror of https://github.com/GNOME/gimp.git
app/unique.c on Win32, if the gimp binary is started without filenames,
2008-07-13 Sven Neumann <sven@gimp.org> * app/unique.c * app/gui/gui-unique.c: on Win32, if the gimp binary is started without filenames, raise the toolbox, just as we do in the DBus code path. svn path=/trunk/; revision=26183
This commit is contained in:
parent
8746d0d0b7
commit
e6e549a2d6
|
@ -1,3 +1,10 @@
|
||||||
|
2008-07-13 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/unique.c
|
||||||
|
* app/gui/gui-unique.c: on Win32, if the gimp binary is started
|
||||||
|
without filenames, raise the toolbox, just as we do in the DBus
|
||||||
|
code path.
|
||||||
|
|
||||||
2008-07-13 Aurimas Juška <aurisj@svn.gnome.org>
|
2008-07-13 Aurimas Juška <aurisj@svn.gnome.org>
|
||||||
|
|
||||||
* app/unique.c (gimp_unique_win32_open): check for NULL pointer to
|
* app/unique.c (gimp_unique_win32_open): check for NULL pointer to
|
||||||
|
|
|
@ -128,12 +128,16 @@ typedef struct
|
||||||
|
|
||||||
static IdleOpenData *
|
static IdleOpenData *
|
||||||
idle_open_data_new (const gchar *name,
|
idle_open_data_new (const gchar *name,
|
||||||
|
gint len,
|
||||||
gboolean as_new)
|
gboolean as_new)
|
||||||
{
|
{
|
||||||
IdleOpenData *data = g_slice_new (IdleOpenData);
|
IdleOpenData *data = g_slice_new0 (IdleOpenData);
|
||||||
|
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
data->name = g_strdup (name);
|
data->name = g_strdup (name);
|
||||||
data->as_new = as_new;
|
data->as_new = as_new;
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +152,19 @@ idle_open_data_free (IdleOpenData *data)
|
||||||
static gboolean
|
static gboolean
|
||||||
gui_unique_win32_idle_open (IdleOpenData *data)
|
gui_unique_win32_idle_open (IdleOpenData *data)
|
||||||
{
|
{
|
||||||
|
if (data->name)
|
||||||
|
{
|
||||||
file_open_from_command_line (unique_gimp, data->name, data->as_new);
|
file_open_from_command_line (unique_gimp, data->name, data->as_new);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* raise the toolbox */
|
||||||
|
const GList *managers = gimp_ui_managers_from_name ("<Image>");
|
||||||
|
|
||||||
|
if (managers)
|
||||||
|
gimp_ui_manager_activate_action (managers->data,
|
||||||
|
"dialogs", "dialogs-toolbox");
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -163,14 +179,16 @@ gui_unique_win32_message_handler (HWND hWnd,
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_COPYDATA:
|
case WM_COPYDATA:
|
||||||
|
if (unique_gimp)
|
||||||
{
|
{
|
||||||
COPYDATASTRUCT *copydata = (COPYDATASTRUCT *) lParam;
|
COPYDATASTRUCT *copydata = (COPYDATASTRUCT *) lParam;
|
||||||
|
|
||||||
if (unique_gimp && copydata->cbData > 0)
|
|
||||||
{
|
|
||||||
GSource *source;
|
GSource *source;
|
||||||
GClosure *closure;
|
GClosure *closure;
|
||||||
IdleOpenData *data = idle_open_data_new (copydata->lpData, copydata->dwData != 0);
|
IdleOpenData *data;
|
||||||
|
|
||||||
|
data = idle_open_data_new (copydata->lpData,
|
||||||
|
copydata->cbData,
|
||||||
|
copydata->dwData != 0);
|
||||||
|
|
||||||
closure = g_cclosure_new (G_CALLBACK (gui_unique_win32_idle_open),
|
closure = g_cclosure_new (G_CALLBACK (gui_unique_win32_idle_open),
|
||||||
data,
|
data,
|
||||||
|
@ -183,7 +201,6 @@ gui_unique_win32_message_handler (HWND hWnd,
|
||||||
g_source_attach (source, NULL);
|
g_source_attach (source, NULL);
|
||||||
g_source_unref (source);
|
g_source_unref (source);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
17
app/unique.c
17
app/unique.c
|
@ -188,14 +188,19 @@ gimp_unique_win32_open (const gchar **filenames,
|
||||||
|
|
||||||
if (window_handle)
|
if (window_handle)
|
||||||
{
|
{
|
||||||
COPYDATASTRUCT copydata;
|
COPYDATASTRUCT copydata = { 0, };
|
||||||
|
|
||||||
|
if (filenames)
|
||||||
|
{
|
||||||
gchar *cwd = g_get_current_dir ();
|
gchar *cwd = g_get_current_dir ();
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; filenames && filenames[i]; i++)
|
for (i = 0; filenames[i]; i++)
|
||||||
{
|
{
|
||||||
gchar *uri = gimp_unique_filename_to_uri (filenames[i], cwd, &error);
|
gchar *uri;
|
||||||
|
|
||||||
|
uri = gimp_unique_filename_to_uri (filenames[i], cwd, &error);
|
||||||
|
|
||||||
if (uri)
|
if (uri)
|
||||||
{
|
{
|
||||||
|
@ -214,6 +219,12 @@ gimp_unique_win32_open (const gchar **filenames,
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (cwd);
|
g_free (cwd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendMessage (window_handle,
|
||||||
|
WM_COPYDATA, window_handle, ©data);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue