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>
|
||||
|
||||
* app/unique.c (gimp_unique_win32_open): check for NULL pointer to
|
||||
|
|
|
@ -128,12 +128,16 @@ typedef struct
|
|||
|
||||
static IdleOpenData *
|
||||
idle_open_data_new (const gchar *name,
|
||||
gint len,
|
||||
gboolean as_new)
|
||||
{
|
||||
IdleOpenData *data = g_slice_new (IdleOpenData);
|
||||
IdleOpenData *data = g_slice_new0 (IdleOpenData);
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
data->name = g_strdup (name);
|
||||
data->as_new = as_new;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -148,7 +152,19 @@ idle_open_data_free (IdleOpenData *data)
|
|||
static gboolean
|
||||
gui_unique_win32_idle_open (IdleOpenData *data)
|
||||
{
|
||||
if (data->name)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -163,14 +179,16 @@ gui_unique_win32_message_handler (HWND hWnd,
|
|||
switch (uMsg)
|
||||
{
|
||||
case WM_COPYDATA:
|
||||
if (unique_gimp)
|
||||
{
|
||||
COPYDATASTRUCT *copydata = (COPYDATASTRUCT *) lParam;
|
||||
|
||||
if (unique_gimp && copydata->cbData > 0)
|
||||
{
|
||||
GSource *source;
|
||||
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),
|
||||
data,
|
||||
|
@ -183,7 +201,6 @@ gui_unique_win32_message_handler (HWND hWnd,
|
|||
g_source_attach (source, NULL);
|
||||
g_source_unref (source);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
|
|
17
app/unique.c
17
app/unique.c
|
@ -188,14 +188,19 @@ gimp_unique_win32_open (const gchar **filenames,
|
|||
|
||||
if (window_handle)
|
||||
{
|
||||
COPYDATASTRUCT copydata;
|
||||
COPYDATASTRUCT copydata = { 0, };
|
||||
|
||||
if (filenames)
|
||||
{
|
||||
gchar *cwd = g_get_current_dir ();
|
||||
GError *error = NULL;
|
||||
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)
|
||||
{
|
||||
|
@ -214,6 +219,12 @@ gimp_unique_win32_open (const gchar **filenames,
|
|||
}
|
||||
|
||||
g_free (cwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage (window_handle,
|
||||
WM_COPYDATA, window_handle, ©data);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue