1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
2004-03-06 03:38:59 +00:00
|
|
|
#include <config.h>
|
1999-03-13 01:14:19 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <sys/param.h>
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <stdlib.h>
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <unistd.h>
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <pwd.h>
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
2002-02-24 02:09:16 +00:00
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#include <glib.h> /* Include early to get G_OS_WIN32 etc */
|
2004-12-12 21:09:13 +00:00
|
|
|
#include <glib/gstdio.h>
|
2002-02-24 02:09:16 +00:00
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#if defined(G_PLATFORM_WIN32)
|
2002-02-24 02:09:16 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#define STRICT
|
|
|
|
#include <windows.h>
|
|
|
|
#undef STRICT
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#endif /* G_PLATFORM_WIN32 */
|
1999-03-13 01:14:19 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gdk/gdkkeysyms.h"
|
|
|
|
#include "gtkbutton.h"
|
2002-01-29 20:53:17 +00:00
|
|
|
#include "gtkcellrenderertext.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkentry.h"
|
|
|
|
#include "gtkfilesel.h"
|
|
|
|
#include "gtkhbox.h"
|
1998-03-22 16:59:59 +00:00
|
|
|
#include "gtkhbbox.h"
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#include "gtkintl.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtklabel.h"
|
2002-01-29 20:53:17 +00:00
|
|
|
#include "gtkliststore.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkmain.h"
|
2002-12-13 23:18:03 +00:00
|
|
|
#include "gtkprivate.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkscrolledwindow.h"
|
Derive from GtkDialog, and use stock buttons. Should be 100% source
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
2000-11-06 16:44:01 +00:00
|
|
|
#include "gtkstock.h"
|
2002-01-29 20:53:17 +00:00
|
|
|
#include "gtktreeselection.h"
|
|
|
|
#include "gtktreeview.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkvbox.h"
|
1998-01-21 07:53:07 +00:00
|
|
|
#include "gtkmenu.h"
|
|
|
|
#include "gtkmenuitem.h"
|
|
|
|
#include "gtkdialog.h"
|
2001-03-12 15:39:19 +00:00
|
|
|
#include "gtkmessagedialog.h"
|
2001-09-19 00:49:52 +00:00
|
|
|
#include "gtkdnd.h"
|
|
|
|
#include "gtkeventbox.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-10-10 17:18:34 +00:00
|
|
|
#undef GTK_DISABLE_DEPRECATED
|
|
|
|
#include "gtkoptionmenu.h"
|
|
|
|
#define GTK_DISABLE_DEPRECATED
|
|
|
|
|
2002-03-08 19:28:50 +00:00
|
|
|
#define WANT_HPANED 1
|
2002-03-03 05:41:28 +00:00
|
|
|
#include "gtkhpaned.h"
|
This might seem like a large patch, but it isn't that bad, and nothing
should break on Unix/X11.
Win32 merge and general portability stuff:
* acconfig.h,configure.in: Check for <sys/time.h>.
* gdk/win32: New directory (actually, been there for a while).
* gtk/fnmatch.c: Include <glib.h> for G_DIR_SEPARATOR, WIN32 and
NATIVE_WIN32, and use these. Always case fold on Win32. No
backslashed escapes on native Win32.
* gtk/{gtk.def,makefile.msc}: New files.
* gtk/Makefile.am: Add above new files.
* gtk/{gtkaccelgroup,gtkbindings}.c: Include <string.h>
instead of <strings.h>.
* gtk/{gtkcalendar,gtkitemfactory,gtkpreview,gtkrc}.c: Include
config.h. Protect inclusion of <sys/param.h>, <sys/time.h>, and
<unistd.h> appropriately.
* gtk/gtkdnd.c: Merge in Win32 version (which doesn't do much).
Use ABS() (from <glib.h>) instead of abs().
* gtk/gtkfilesel.c: Moved Win32-specific includes after inclusion
of gtk (and thus glib) headers, so that WIN32 will be
defined. With MS C, include <direct.h> for mkdir prototype.
* gtk/gtkitemfactory.c (gtk_item_factory_callback_marshal): Add
some casts, needed by MS C.
* gtk/{gtklayout,gtkplug}.c: Merge in Win32 version (which isn't
implemented).
* gtk/gtkmain.c: Include gdk/gdkx.h for GDK_WINDOWING. Include
<X11/Xlocale.h> only on X11 platform, otherwise <locale.h>. Use
G_SEARCHPATH_SEPARATOR_S and g_module_build_path.
* gtk/gtkmain.h: Mark variables for export/import on Win32.
* gtk/gtkrange.c (gtk_range_motion_notify): Set mods also in case
the event is not a hint, or its window is not the slider. Needed
on Win32, at least.
* gtk/gtkrc.c: Include config.h and gdk/gdkx.h. Use <locale.h>
unless on X11. Skip \r chars, too. Use G_DIR_SEPARATOR and
G_SEARCHPATH_SEPARATOR(_S). Use g_path_is_absolute. On Win32, use
a subdirectory of the Windows directory as gtk system
configuration directory.
* gtk/gtkselection.c: No chunks on Win32.
* gtk/gtksocket.c: Not implemented on Win32.
* gtk/gtkthemes.c (gtk_theme_engine_get): Use g_module_build_path.
* gtk/makeenums.h: Include gdkprivate.h after gdk.h.
* gtk/testrgb.c: Use dynamically allocated buffer. Use GTimers.
1999-03-15 00:03:37 +00:00
|
|
|
|
2005-03-20 07:01:23 +00:00
|
|
|
#include "gtkalias.h"
|
|
|
|
|
1999-10-04 19:03:05 +00:00
|
|
|
#ifdef G_OS_WIN32
|
This might seem like a large patch, but it isn't that bad, and nothing
should break on Unix/X11.
Win32 merge and general portability stuff:
* acconfig.h,configure.in: Check for <sys/time.h>.
* gdk/win32: New directory (actually, been there for a while).
* gtk/fnmatch.c: Include <glib.h> for G_DIR_SEPARATOR, WIN32 and
NATIVE_WIN32, and use these. Always case fold on Win32. No
backslashed escapes on native Win32.
* gtk/{gtk.def,makefile.msc}: New files.
* gtk/Makefile.am: Add above new files.
* gtk/{gtkaccelgroup,gtkbindings}.c: Include <string.h>
instead of <strings.h>.
* gtk/{gtkcalendar,gtkitemfactory,gtkpreview,gtkrc}.c: Include
config.h. Protect inclusion of <sys/param.h>, <sys/time.h>, and
<unistd.h> appropriately.
* gtk/gtkdnd.c: Merge in Win32 version (which doesn't do much).
Use ABS() (from <glib.h>) instead of abs().
* gtk/gtkfilesel.c: Moved Win32-specific includes after inclusion
of gtk (and thus glib) headers, so that WIN32 will be
defined. With MS C, include <direct.h> for mkdir prototype.
* gtk/gtkitemfactory.c (gtk_item_factory_callback_marshal): Add
some casts, needed by MS C.
* gtk/{gtklayout,gtkplug}.c: Merge in Win32 version (which isn't
implemented).
* gtk/gtkmain.c: Include gdk/gdkx.h for GDK_WINDOWING. Include
<X11/Xlocale.h> only on X11 platform, otherwise <locale.h>. Use
G_SEARCHPATH_SEPARATOR_S and g_module_build_path.
* gtk/gtkmain.h: Mark variables for export/import on Win32.
* gtk/gtkrange.c (gtk_range_motion_notify): Set mods also in case
the event is not a hint, or its window is not the slider. Needed
on Win32, at least.
* gtk/gtkrc.c: Include config.h and gdk/gdkx.h. Use <locale.h>
unless on X11. Skip \r chars, too. Use G_DIR_SEPARATOR and
G_SEARCHPATH_SEPARATOR(_S). Use g_path_is_absolute. On Win32, use
a subdirectory of the Windows directory as gtk system
configuration directory.
* gtk/gtkselection.c: No chunks on Win32.
* gtk/gtksocket.c: Not implemented on Win32.
* gtk/gtkthemes.c (gtk_theme_engine_get): Use g_module_build_path.
* gtk/makeenums.h: Include gdkprivate.h after gdk.h.
* gtk/testrgb.c: Use dynamically allocated buffer. Use GTimers.
1999-03-15 00:03:37 +00:00
|
|
|
#include <direct.h>
|
1999-04-25 21:55:05 +00:00
|
|
|
#include <io.h>
|
This might seem like a large patch, but it isn't that bad, and nothing
should break on Unix/X11.
Win32 merge and general portability stuff:
* acconfig.h,configure.in: Check for <sys/time.h>.
* gdk/win32: New directory (actually, been there for a while).
* gtk/fnmatch.c: Include <glib.h> for G_DIR_SEPARATOR, WIN32 and
NATIVE_WIN32, and use these. Always case fold on Win32. No
backslashed escapes on native Win32.
* gtk/{gtk.def,makefile.msc}: New files.
* gtk/Makefile.am: Add above new files.
* gtk/{gtkaccelgroup,gtkbindings}.c: Include <string.h>
instead of <strings.h>.
* gtk/{gtkcalendar,gtkitemfactory,gtkpreview,gtkrc}.c: Include
config.h. Protect inclusion of <sys/param.h>, <sys/time.h>, and
<unistd.h> appropriately.
* gtk/gtkdnd.c: Merge in Win32 version (which doesn't do much).
Use ABS() (from <glib.h>) instead of abs().
* gtk/gtkfilesel.c: Moved Win32-specific includes after inclusion
of gtk (and thus glib) headers, so that WIN32 will be
defined. With MS C, include <direct.h> for mkdir prototype.
* gtk/gtkitemfactory.c (gtk_item_factory_callback_marshal): Add
some casts, needed by MS C.
* gtk/{gtklayout,gtkplug}.c: Merge in Win32 version (which isn't
implemented).
* gtk/gtkmain.c: Include gdk/gdkx.h for GDK_WINDOWING. Include
<X11/Xlocale.h> only on X11 platform, otherwise <locale.h>. Use
G_SEARCHPATH_SEPARATOR_S and g_module_build_path.
* gtk/gtkmain.h: Mark variables for export/import on Win32.
* gtk/gtkrange.c (gtk_range_motion_notify): Set mods also in case
the event is not a hint, or its window is not the slider. Needed
on Win32, at least.
* gtk/gtkrc.c: Include config.h and gdk/gdkx.h. Use <locale.h>
unless on X11. Skip \r chars, too. Use G_DIR_SEPARATOR and
G_SEARCHPATH_SEPARATOR(_S). Use g_path_is_absolute. On Win32, use
a subdirectory of the Windows directory as gtk system
configuration directory.
* gtk/gtkselection.c: No chunks on Win32.
* gtk/gtksocket.c: Not implemented on Win32.
* gtk/gtkthemes.c (gtk_theme_engine_get): Use g_module_build_path.
* gtk/makeenums.h: Include gdkprivate.h after gdk.h.
* gtk/testrgb.c: Use dynamically allocated buffer. Use GTimers.
1999-03-15 00:03:37 +00:00
|
|
|
#ifndef S_ISDIR
|
|
|
|
#define S_ISDIR(mode) ((mode)&_S_IFDIR)
|
|
|
|
#endif
|
1999-10-04 19:03:05 +00:00
|
|
|
#endif /* G_OS_WIN32 */
|
1999-04-25 21:55:05 +00:00
|
|
|
|
2002-08-31 17:33:43 +00:00
|
|
|
#ifdef G_WITH_CYGWIN
|
|
|
|
#include <sys/cygwin.h> /* For cygwin_conv_to_posix_path */
|
|
|
|
#endif
|
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
#define DIR_LIST_WIDTH 180
|
|
|
|
#define DIR_LIST_HEIGHT 180
|
|
|
|
#define FILE_LIST_WIDTH 180
|
|
|
|
#define FILE_LIST_HEIGHT 180
|
1997-11-24 22:37:52 +00:00
|
|
|
|
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
* gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix),
since some people set $(libdir) separately. (#1290, David Kaelbling)
Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not
defined, define MAXPATHLEN to 2048. (The Hurd doesn't have
MAXPATHLEN, but the code here depends on a fixed value.)
(#4524)
Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case
where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g)
Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (real_tree_move): If the node being moved isn't
viewable there is no way that moving the node will cause the
focus row to become not viewable, so omit check on the visibility
of new_sibling, which is irrelevant. (Fixes #8002, David Helder)
Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current
selection before inserting new text.
Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb):
Make the sensitivity of the reparented child track that of
the original parent menu item. (#34218, David Hodson)
* gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle
the case where the current item is destroyed properly.
* gtk/gtkoptionmenu.c: Some additional code cleanups and fix
some edge cases with child-less menuitems.
Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return
key pop down window. (#12074, Jon K Hellan)
Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow
toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan)
The solution here isn't perfect - you get an extraneous
emission of "toggle", which could conceivably confuse an app,
but better than the current situation. LXR search seems to
indicate that no apps in GNOME CVS connect to "toggle".
Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from
gtk_public_h_sources to directly here to avoid warning when
building srcdir != builddir. (#9656)
Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c: Patch from Kipp Hickman to make the event
handlers in gtkrange.c return the proper values (TRUE == handled)
(#10316).
This is just the tip of the iceberg, but gtkrange.c is the
most common place where the propagation is problematical,
and also a place where it is almost certainly safe to change
this in the stable branch.
(You don't want right click popups on a range control or anything...)
Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_focus_area): We need to clear the focus
area on focus out, even if a background pixmap isn't set.
(#13941)
Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham
to deal with setting the shape properly when scrolling arrows are
turned on, but not visible because there is sufficient space.
(#13432)
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu
items with submenus, destroy the item along with the submenu.
(#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where
the focus widget sometimes wasn't drawn with the default if there
was no default widget.
* gtk/gtkstyle.c (gtk_style_real_unrealize): free colors,
unreference pixmaps.
* gtk/gtkstyle.c (gtk_style_realize): Reference colormap
for some extra safety.
Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting
the text of a cell to the old pointer value better, by
copying the new text before freeing the old text. Some code
cleanup. (#8079, Karl Nelson)
Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text()
gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN.
Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenu.c (gtk_menu_remove): When removing an
item from a menu, check to see if it matches
menu->old_active_menu_item, and if so, unref and clear
old_active_menu_item (Patch from Pavel Cisler)
* gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset
menu_shell->active_menu_item, if it is the child being
removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
|
|
|
/* The Hurd doesn't define either PATH_MAX or MAXPATHLEN, so we put this
|
|
|
|
* in here, since the rest of the code in the file does require some
|
|
|
|
* fixed maximum.
|
|
|
|
*/
|
|
|
|
#ifndef MAXPATHLEN
|
|
|
|
# ifdef PATH_MAX
|
|
|
|
# define MAXPATHLEN PATH_MAX
|
|
|
|
# else
|
|
|
|
# define MAXPATHLEN 2048
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
1998-01-21 09:06:05 +00:00
|
|
|
/* I've put this here so it doesn't get confused with the
|
|
|
|
* file completion interface */
|
|
|
|
typedef struct _HistoryCallbackArg HistoryCallbackArg;
|
|
|
|
|
|
|
|
struct _HistoryCallbackArg
|
|
|
|
{
|
|
|
|
gchar *directory;
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
};
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
typedef struct _CompletionState CompletionState;
|
|
|
|
typedef struct _CompletionDir CompletionDir;
|
|
|
|
typedef struct _CompletionDirSent CompletionDirSent;
|
|
|
|
typedef struct _CompletionDirEntry CompletionDirEntry;
|
|
|
|
typedef struct _CompletionUserDir CompletionUserDir;
|
|
|
|
typedef struct _PossibleCompletion PossibleCompletion;
|
|
|
|
|
|
|
|
/* Non-external file completion decls and structures */
|
|
|
|
|
|
|
|
/* A contant telling PRCS how many directories to cache. Its actually
|
|
|
|
* kept in a list, so the geometry isn't important. */
|
|
|
|
#define CMPL_DIRECTORY_CACHE_SIZE 10
|
|
|
|
|
|
|
|
/* A constant used to determine whether a substring was an exact
|
|
|
|
* match by first_diff_index()
|
|
|
|
*/
|
|
|
|
#define PATTERN_MATCH -1
|
|
|
|
#define CMPL_ERRNO_TOO_LONG ((1<<16)-1)
|
2001-03-12 15:39:19 +00:00
|
|
|
#define CMPL_ERRNO_DID_NOT_CONVERT ((1<<16)-2)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* This structure contains all the useful information about a directory
|
|
|
|
* for the purposes of filename completion. These structures are cached
|
|
|
|
* in the CompletionState struct. CompletionDir's are reference counted.
|
|
|
|
*/
|
|
|
|
struct _CompletionDirSent
|
|
|
|
{
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
1997-11-24 22:37:52 +00:00
|
|
|
ino_t inode;
|
|
|
|
time_t mtime;
|
1998-04-07 23:59:25 +00:00
|
|
|
dev_t device;
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gint entry_count;
|
|
|
|
struct _CompletionDirEntry *entries;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _CompletionDir
|
|
|
|
{
|
|
|
|
CompletionDirSent *sent;
|
|
|
|
|
|
|
|
gchar *fullname;
|
|
|
|
gint fullname_len;
|
|
|
|
|
|
|
|
struct _CompletionDir *cmpl_parent;
|
|
|
|
gint cmpl_index;
|
|
|
|
gchar *cmpl_text;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This structure contains pairs of directory entry names with a flag saying
|
|
|
|
* whether or not they are a valid directory. NOTE: This information is used
|
|
|
|
* to provide the caller with information about whether to update its completions
|
|
|
|
* or try to open a file. Since directories are cached by the directory mtime,
|
|
|
|
* a symlink which points to an invalid file (which will not be a directory),
|
|
|
|
* will not be reevaluated if that file is created, unless the containing
|
|
|
|
* directory is touched. I consider this case to be worth ignoring (josh).
|
|
|
|
*/
|
|
|
|
struct _CompletionDirEntry
|
|
|
|
{
|
2000-02-03 01:19:03 +00:00
|
|
|
gboolean is_dir;
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar *entry_name;
|
2002-12-13 23:28:56 +00:00
|
|
|
gchar *sort_key;
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _CompletionUserDir
|
|
|
|
{
|
|
|
|
gchar *login;
|
|
|
|
gchar *homedir;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _PossibleCompletion
|
|
|
|
{
|
|
|
|
/* accessible fields, all are accessed externally by functions
|
|
|
|
* declared above
|
|
|
|
*/
|
|
|
|
gchar *text;
|
|
|
|
gint is_a_completion;
|
2000-02-03 01:19:03 +00:00
|
|
|
gboolean is_directory;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* Private fields
|
|
|
|
*/
|
|
|
|
gint text_alloc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _CompletionState
|
|
|
|
{
|
|
|
|
gint last_valid_char;
|
|
|
|
gchar *updated_text;
|
|
|
|
gint updated_text_len;
|
|
|
|
gint updated_text_alloc;
|
2000-02-03 01:19:03 +00:00
|
|
|
gboolean re_complete;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gchar *user_dir_name_buffer;
|
|
|
|
gint user_directories_len;
|
|
|
|
|
|
|
|
gchar *last_completion_text;
|
|
|
|
|
|
|
|
gint user_completion_index; /* if >= 0, currently completing ~user */
|
|
|
|
|
|
|
|
struct _CompletionDir *completion_dir; /* directory completing from */
|
|
|
|
struct _CompletionDir *active_completion_dir;
|
|
|
|
|
|
|
|
struct _PossibleCompletion the_completion;
|
|
|
|
|
|
|
|
struct _CompletionDir *reference_dir; /* initial directory */
|
|
|
|
|
|
|
|
GList* directory_storage;
|
|
|
|
GList* directory_sent_storage;
|
|
|
|
|
|
|
|
struct _CompletionUserDir *user_directories;
|
|
|
|
};
|
|
|
|
|
2001-03-23 23:39:24 +00:00
|
|
|
enum {
|
|
|
|
PROP_0,
|
|
|
|
PROP_SHOW_FILEOPS,
|
2002-02-18 03:29:00 +00:00
|
|
|
PROP_FILENAME,
|
|
|
|
PROP_SELECT_MULTIPLE
|
2001-03-23 23:39:24 +00:00
|
|
|
};
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
enum {
|
|
|
|
DIR_COLUMN
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
FILE_COLUMN
|
|
|
|
};
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* File completion functions which would be external, were they used
|
|
|
|
* outside of this file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static CompletionState* cmpl_init_state (void);
|
|
|
|
static void cmpl_free_state (CompletionState *cmpl_state);
|
|
|
|
static gint cmpl_state_okay (CompletionState* cmpl_state);
|
2001-10-23 16:02:23 +00:00
|
|
|
static const gchar* cmpl_strerror (gint);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static PossibleCompletion* cmpl_completion_matches(gchar *text_to_complete,
|
|
|
|
gchar **remaining_text,
|
|
|
|
CompletionState *cmpl_state);
|
|
|
|
|
|
|
|
/* Returns a name for consideration, possibly a completion, this name
|
|
|
|
* will be invalid after the next call to cmpl_next_completion.
|
|
|
|
*/
|
|
|
|
static char* cmpl_this_completion (PossibleCompletion*);
|
|
|
|
|
|
|
|
/* True if this completion matches the given text. Otherwise, this
|
|
|
|
* output can be used to have a list of non-completions.
|
|
|
|
*/
|
|
|
|
static gint cmpl_is_a_completion (PossibleCompletion*);
|
|
|
|
|
|
|
|
/* True if the completion is a directory
|
|
|
|
*/
|
2000-02-03 01:19:03 +00:00
|
|
|
static gboolean cmpl_is_directory (PossibleCompletion*);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* Obtains the next completion, or NULL
|
|
|
|
*/
|
|
|
|
static PossibleCompletion* cmpl_next_completion (CompletionState*);
|
|
|
|
|
|
|
|
/* Updating completions: the return value of cmpl_updated_text() will
|
|
|
|
* be text_to_complete completed as much as possible after the most
|
|
|
|
* recent call to cmpl_completion_matches. For the present
|
|
|
|
* application, this is the suggested replacement for the user's input
|
|
|
|
* string. You must CALL THIS AFTER ALL cmpl_text_completions have
|
|
|
|
* been received.
|
|
|
|
*/
|
|
|
|
static gchar* cmpl_updated_text (CompletionState* cmpl_state);
|
|
|
|
|
|
|
|
/* After updating, to see if the completion was a directory, call
|
|
|
|
* this. If it was, you should consider re-calling completion_matches.
|
|
|
|
*/
|
2000-02-03 01:19:03 +00:00
|
|
|
static gboolean cmpl_updated_dir (CompletionState* cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* Current location: if using file completion, return the current
|
|
|
|
* directory, from which file completion begins. More specifically,
|
|
|
|
* the cwd concatenated with all exact completions up to the last
|
|
|
|
* directory delimiter('/').
|
|
|
|
*/
|
|
|
|
static gchar* cmpl_reference_position (CompletionState* cmpl_state);
|
|
|
|
|
2003-08-14 22:30:28 +00:00
|
|
|
#if 0
|
|
|
|
/* This doesn't work currently and would require changes
|
|
|
|
* to fnmatch.c to get working.
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
/* backing up: if cmpl_completion_matches returns NULL, you may query
|
|
|
|
* the index of the last completable character into cmpl_updated_text.
|
|
|
|
*/
|
|
|
|
static gint cmpl_last_valid_char (CompletionState* cmpl_state);
|
2003-08-14 22:30:28 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* When the user selects a non-directory, call cmpl_completion_fullname
|
|
|
|
* to get the full name of the selected file.
|
|
|
|
*/
|
2003-08-01 21:20:21 +00:00
|
|
|
static gchar* cmpl_completion_fullname (const gchar*, CompletionState* cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Directory operations. */
|
|
|
|
static CompletionDir* open_ref_dir (gchar* text_to_complete,
|
|
|
|
gchar** remaining_text,
|
|
|
|
CompletionState* cmpl_state);
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
1998-09-12 14:41:04 +00:00
|
|
|
static gboolean check_dir (gchar *dir_name,
|
|
|
|
struct stat *result,
|
|
|
|
gboolean *stat_subdirs);
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
static CompletionDir* open_dir (gchar* dir_name,
|
|
|
|
CompletionState* cmpl_state);
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
2001-10-23 16:02:23 +00:00
|
|
|
static CompletionDir* open_user_dir (const gchar* text_to_complete,
|
1997-11-24 22:37:52 +00:00
|
|
|
CompletionState *cmpl_state);
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
static CompletionDir* open_relative_dir (gchar* dir_name, CompletionDir* dir,
|
|
|
|
CompletionState *cmpl_state);
|
1998-09-12 14:41:04 +00:00
|
|
|
static CompletionDirSent* open_new_dir (gchar* dir_name,
|
|
|
|
struct stat* sbuf,
|
|
|
|
gboolean stat_subdirs);
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint correct_dir_fullname (CompletionDir* cmpl_dir);
|
|
|
|
static gint correct_parent (CompletionDir* cmpl_dir,
|
|
|
|
struct stat *sbuf);
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
1997-11-24 22:37:52 +00:00
|
|
|
static gchar* find_parent_dir_fullname (gchar* dirname);
|
2002-02-24 02:09:16 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
static CompletionDir* attach_dir (CompletionDirSent* sent,
|
|
|
|
gchar* dir_name,
|
|
|
|
CompletionState *cmpl_state);
|
|
|
|
static void free_dir_sent (CompletionDirSent* sent);
|
|
|
|
static void free_dir (CompletionDir *dir);
|
|
|
|
static void prune_memory_usage(CompletionState *cmpl_state);
|
|
|
|
|
|
|
|
/* Completion operations */
|
2002-02-24 02:09:16 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
1997-11-24 22:37:52 +00:00
|
|
|
static PossibleCompletion* attempt_homedir_completion(gchar* text_to_complete,
|
|
|
|
CompletionState *cmpl_state);
|
2002-02-24 02:09:16 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
static PossibleCompletion* attempt_file_completion(CompletionState *cmpl_state);
|
|
|
|
static CompletionDir* find_completion_dir(gchar* text_to_complete,
|
|
|
|
gchar** remaining_text,
|
|
|
|
CompletionState* cmpl_state);
|
|
|
|
static PossibleCompletion* append_completion_text(gchar* text,
|
|
|
|
CompletionState* cmpl_state);
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint get_pwdb(CompletionState* cmpl_state);
|
|
|
|
static gint compare_user_dir(const void* a, const void* b);
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
|
|
|
static gint first_diff_index(gchar* pat, gchar* text);
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint compare_cmpl_dir(const void* a, const void* b);
|
|
|
|
static void update_cmpl(PossibleCompletion* poss,
|
|
|
|
CompletionState* cmpl_state);
|
|
|
|
|
|
|
|
static void gtk_file_selection_class_init (GtkFileSelectionClass *klass);
|
2001-03-23 23:39:24 +00:00
|
|
|
static void gtk_file_selection_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gtk_file_selection_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_file_selection_init (GtkFileSelection *filesel);
|
2001-10-23 16:02:23 +00:00
|
|
|
static void gtk_file_selection_finalize (GObject *object);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_file_selection_destroy (GtkObject *object);
|
2002-01-17 00:53:50 +00:00
|
|
|
static void gtk_file_selection_map (GtkWidget *widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint gtk_file_selection_key_press (GtkWidget *widget,
|
|
|
|
GdkEventKey *event,
|
|
|
|
gpointer user_data);
|
2001-03-12 15:39:19 +00:00
|
|
|
static gint gtk_file_selection_insert_text (GtkWidget *widget,
|
|
|
|
const gchar *new_text,
|
|
|
|
gint new_text_length,
|
|
|
|
gint *position,
|
|
|
|
gpointer user_data);
|
2002-10-25 19:57:48 +00:00
|
|
|
static void gtk_file_selection_update_fileops (GtkFileSelection *filesel);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
static void gtk_file_selection_file_activate (GtkTreeView *tree_view,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkTreeViewColumn *column,
|
|
|
|
gpointer user_data);
|
|
|
|
static void gtk_file_selection_file_changed (GtkTreeSelection *selection,
|
|
|
|
gpointer user_data);
|
|
|
|
static void gtk_file_selection_dir_activate (GtkTreeView *tree_view,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkTreeViewColumn *column,
|
|
|
|
gpointer user_data);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_file_selection_populate (GtkFileSelection *fs,
|
|
|
|
gchar *rel_path,
|
2002-01-17 01:37:06 +00:00
|
|
|
gboolean try_complete,
|
|
|
|
gboolean reset_entry);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_file_selection_abort (GtkFileSelection *fs);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
static void gtk_file_selection_update_history_menu (GtkFileSelection *fs,
|
|
|
|
gchar *current_dir);
|
|
|
|
|
2002-02-17 00:07:48 +00:00
|
|
|
static void gtk_file_selection_create_dir (GtkWidget *widget, gpointer data);
|
1998-01-21 07:53:07 +00:00
|
|
|
static void gtk_file_selection_delete_file (GtkWidget *widget, gpointer data);
|
|
|
|
static void gtk_file_selection_rename_file (GtkWidget *widget, gpointer data);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-02-17 00:07:48 +00:00
|
|
|
static void free_selected_names (GPtrArray *names);
|
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
|
|
|
|
|
|
|
#define compare_utf8_filenames(a, b) strcmp(a, b)
|
|
|
|
#define compare_sys_filenames(a, b) strcmp(a, b)
|
|
|
|
|
2002-02-17 00:07:48 +00:00
|
|
|
#else
|
1997-11-24 22:37:52 +00:00
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
static gint
|
|
|
|
compare_utf8_filenames (const gchar *a,
|
|
|
|
const gchar *b)
|
|
|
|
{
|
|
|
|
gchar *a_folded, *b_folded;
|
|
|
|
gint retval;
|
|
|
|
|
|
|
|
a_folded = g_utf8_strdown (a, -1);
|
|
|
|
b_folded = g_utf8_strdown (b, -1);
|
|
|
|
|
|
|
|
retval = strcmp (a_folded, b_folded);
|
|
|
|
|
|
|
|
g_free (a_folded);
|
|
|
|
g_free (b_folded);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
compare_sys_filenames (const gchar *a,
|
|
|
|
const gchar *b)
|
|
|
|
{
|
|
|
|
gchar *a_utf8, *b_utf8;
|
|
|
|
gint retval;
|
|
|
|
|
|
|
|
a_utf8 = g_filename_to_utf8 (a, -1, NULL, NULL, NULL);
|
|
|
|
b_utf8 = g_filename_to_utf8 (b, -1, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
retval = compare_utf8_filenames (a_utf8, b_utf8);
|
|
|
|
|
|
|
|
g_free (a_utf8);
|
|
|
|
g_free (b_utf8);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
static GtkWindowClass *parent_class = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* Saves errno when something cmpl does fails. */
|
|
|
|
static gint cmpl_errno;
|
|
|
|
|
1999-10-06 19:47:24 +00:00
|
|
|
#ifdef G_WITH_CYGWIN
|
1999-03-13 01:14:19 +00:00
|
|
|
/*
|
|
|
|
* Take the path currently in the file selection
|
|
|
|
* entry field and translate as necessary from
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
* a Win32 style to Cygwin style path. For
|
1999-03-13 01:14:19 +00:00
|
|
|
* instance translate:
|
|
|
|
* x:\somepath\file.jpg
|
|
|
|
* to:
|
2002-08-31 17:33:43 +00:00
|
|
|
* /cygdrive/x/somepath/file.jpg
|
1999-03-13 01:14:19 +00:00
|
|
|
*
|
|
|
|
* Replace the path in the selection text field.
|
|
|
|
* Return a boolean value concerning whether a
|
|
|
|
* translation had to be made.
|
|
|
|
*/
|
2002-02-27 16:37:04 +00:00
|
|
|
static int
|
2000-08-12 07:25:55 +00:00
|
|
|
translate_win32_path (GtkFileSelection *filesel)
|
1999-03-13 01:14:19 +00:00
|
|
|
{
|
|
|
|
int updated = 0;
|
2002-08-31 17:33:43 +00:00
|
|
|
const gchar *path;
|
|
|
|
gchar newPath[MAX_PATH];
|
1999-03-13 01:14:19 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Retrieve the current path
|
|
|
|
*/
|
|
|
|
path = gtk_entry_get_text (GTK_ENTRY (filesel->selection_entry));
|
|
|
|
|
2002-08-31 17:33:43 +00:00
|
|
|
cygwin_conv_to_posix_path (path, newPath);
|
|
|
|
updated = (strcmp (path, newPath) != 0);
|
1999-03-13 01:14:19 +00:00
|
|
|
|
2002-08-31 17:33:43 +00:00
|
|
|
if (updated)
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), newPath);
|
1999-03-13 01:14:19 +00:00
|
|
|
|
|
|
|
return updated;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
GType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_file_selection_get_type (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2002-10-09 22:11:08 +00:00
|
|
|
static GType file_selection_type = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (!file_selection_type)
|
|
|
|
{
|
2002-10-09 22:11:08 +00:00
|
|
|
static const GTypeInfo filesel_info =
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
sizeof (GtkFileSelectionClass),
|
2002-10-09 22:11:08 +00:00
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
|
|
|
(GClassInitFunc) gtk_file_selection_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GtkFileSelection),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gtk_file_selection_init,
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
file_selection_type =
|
2005-09-01 05:11:46 +00:00
|
|
|
g_type_register_static (GTK_TYPE_DIALOG, I_("GtkFileSelection"),
|
2002-10-09 22:11:08 +00:00
|
|
|
&filesel_info, 0);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return file_selection_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_file_selection_class_init (GtkFileSelectionClass *class)
|
|
|
|
{
|
2001-03-23 23:39:24 +00:00
|
|
|
GObjectClass *gobject_class;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkObjectClass *object_class;
|
2002-01-17 00:53:50 +00:00
|
|
|
GtkWidgetClass *widget_class;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-03-23 23:39:24 +00:00
|
|
|
gobject_class = (GObjectClass*) class;
|
1997-11-24 22:37:52 +00:00
|
|
|
object_class = (GtkObjectClass*) class;
|
2002-01-17 00:53:50 +00:00
|
|
|
widget_class = (GtkWidgetClass*) class;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
parent_class = g_type_class_peek_parent (class);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-10-23 16:02:23 +00:00
|
|
|
gobject_class->finalize = gtk_file_selection_finalize;
|
2001-03-23 23:39:24 +00:00
|
|
|
gobject_class->set_property = gtk_file_selection_set_property;
|
|
|
|
gobject_class->get_property = gtk_file_selection_get_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_FILENAME,
|
|
|
|
g_param_spec_string ("filename",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Filename"),
|
|
|
|
P_("The currently selected filename"),
|
2001-03-23 23:39:24 +00:00
|
|
|
NULL,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2001-03-23 23:39:24 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_SHOW_FILEOPS,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("show-fileops",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Show file operations"),
|
|
|
|
P_("Whether buttons for creating/manipulating files should be displayed"),
|
2001-03-23 23:39:24 +00:00
|
|
|
FALSE,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2002-02-18 03:29:00 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_SELECT_MULTIPLE,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("select-multiple",
|
2005-09-09 16:21:15 +00:00
|
|
|
P_("Select Multiple"),
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Whether to allow multiple files to be selected"),
|
2002-02-18 03:29:00 +00:00
|
|
|
FALSE,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
1997-11-24 22:37:52 +00:00
|
|
|
object_class->destroy = gtk_file_selection_destroy;
|
2002-01-17 00:53:50 +00:00
|
|
|
widget_class->map = gtk_file_selection_map;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2001-03-23 23:39:24 +00:00
|
|
|
static void gtk_file_selection_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkFileSelection *filesel;
|
|
|
|
|
|
|
|
filesel = GTK_FILE_SELECTION (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_FILENAME:
|
|
|
|
gtk_file_selection_set_filename (filesel,
|
|
|
|
g_value_get_string (value));
|
|
|
|
break;
|
|
|
|
case PROP_SHOW_FILEOPS:
|
|
|
|
if (g_value_get_boolean (value))
|
|
|
|
gtk_file_selection_show_fileop_buttons (filesel);
|
|
|
|
else
|
|
|
|
gtk_file_selection_hide_fileop_buttons (filesel);
|
|
|
|
break;
|
2002-02-18 03:29:00 +00:00
|
|
|
case PROP_SELECT_MULTIPLE:
|
|
|
|
gtk_file_selection_set_select_multiple (filesel, g_value_get_boolean (value));
|
|
|
|
break;
|
2001-03-23 23:39:24 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gtk_file_selection_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkFileSelection *filesel;
|
|
|
|
|
|
|
|
filesel = GTK_FILE_SELECTION (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_FILENAME:
|
|
|
|
g_value_set_string (value,
|
|
|
|
gtk_file_selection_get_filename(filesel));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_SHOW_FILEOPS:
|
|
|
|
/* This is a little bit hacky, but doing otherwise would require
|
|
|
|
* adding a field to the object.
|
|
|
|
*/
|
|
|
|
g_value_set_boolean (value, (filesel->fileop_c_dir &&
|
|
|
|
filesel->fileop_del_file &&
|
|
|
|
filesel->fileop_ren_file));
|
|
|
|
break;
|
2002-02-18 03:29:00 +00:00
|
|
|
case PROP_SELECT_MULTIPLE:
|
|
|
|
g_value_set_boolean (value, gtk_file_selection_get_select_multiple (filesel));
|
|
|
|
break;
|
2001-03-23 23:39:24 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-20 10:59:48 +00:00
|
|
|
static gboolean
|
|
|
|
grab_default (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
gtk_widget_grab_default (widget);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_file_selection_init (GtkFileSelection *filesel)
|
|
|
|
{
|
|
|
|
GtkWidget *entry_vbox;
|
|
|
|
GtkWidget *label;
|
2002-03-03 05:41:28 +00:00
|
|
|
GtkWidget *list_hbox, *list_container;
|
1998-01-21 07:53:07 +00:00
|
|
|
GtkWidget *pulldown_hbox;
|
1998-11-05 15:44:22 +00:00
|
|
|
GtkWidget *scrolled_win;
|
2001-09-19 00:49:52 +00:00
|
|
|
GtkWidget *eventbox;
|
2002-03-08 19:28:50 +00:00
|
|
|
GtkWidget *spacer;
|
Derive from GtkDialog, and use stock buttons. Should be 100% source
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
2000-11-06 16:44:01 +00:00
|
|
|
GtkDialog *dialog;
|
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
GtkListStore *model;
|
|
|
|
GtkTreeViewColumn *column;
|
|
|
|
|
2002-01-17 23:43:23 +00:00
|
|
|
gtk_widget_push_composite_child ();
|
|
|
|
|
Derive from GtkDialog, and use stock buttons. Should be 100% source
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
2000-11-06 16:44:01 +00:00
|
|
|
dialog = GTK_DIALOG (filesel);
|
2001-03-12 15:39:19 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
filesel->cmpl_state = cmpl_init_state ();
|
1998-03-06 05:03:15 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
/* The dialog-sized vertical box */
|
Derive from GtkDialog, and use stock buttons. Should be 100% source
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
2000-11-06 16:44:01 +00:00
|
|
|
filesel->main_vbox = dialog->vbox;
|
1998-11-28 07:42:37 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (filesel), 10);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
/* The horizontal box containing create, rename etc. buttons */
|
1998-03-22 16:59:59 +00:00
|
|
|
filesel->button_area = gtk_hbutton_box_new ();
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_button_box_set_layout (GTK_BUTTON_BOX (filesel->button_area), GTK_BUTTONBOX_START);
|
2001-03-07 21:10:44 +00:00
|
|
|
gtk_box_set_spacing (GTK_BOX (filesel->button_area), 0);
|
1998-03-06 05:03:15 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), filesel->button_area,
|
1998-01-21 07:53:07 +00:00
|
|
|
FALSE, FALSE, 0);
|
1998-03-06 05:03:15 +00:00
|
|
|
gtk_widget_show (filesel->button_area);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_file_selection_show_fileop_buttons (filesel);
|
1998-03-06 05:03:15 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
/* hbox for pulldown menu */
|
|
|
|
pulldown_hbox = gtk_hbox_new (TRUE, 5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), pulldown_hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (pulldown_hbox);
|
|
|
|
|
|
|
|
/* Pulldown menu */
|
|
|
|
filesel->history_pulldown = gtk_option_menu_new ();
|
|
|
|
gtk_widget_show (filesel->history_pulldown);
|
|
|
|
gtk_box_pack_start (GTK_BOX (pulldown_hbox), filesel->history_pulldown,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* The horizontal box containing the directory and file listboxes */
|
2002-03-08 19:28:50 +00:00
|
|
|
|
|
|
|
spacer = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_widget_set_size_request (spacer, -1, 5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), spacer, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (spacer);
|
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
list_hbox = gtk_hbox_new (FALSE, 5);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), list_hbox, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (list_hbox);
|
2002-03-08 19:28:50 +00:00
|
|
|
if (WANT_HPANED)
|
2002-03-03 05:41:28 +00:00
|
|
|
list_container = g_object_new (GTK_TYPE_HPANED,
|
|
|
|
"visible", TRUE,
|
|
|
|
"parent", list_hbox,
|
2002-03-08 19:28:50 +00:00
|
|
|
"border_width", 0,
|
2002-03-03 05:41:28 +00:00
|
|
|
NULL);
|
|
|
|
else
|
|
|
|
list_container = list_hbox;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-03-08 19:28:50 +00:00
|
|
|
spacer = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_widget_set_size_request (spacer, -1, 5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), spacer, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (spacer);
|
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
/* The directories list */
|
|
|
|
|
|
|
|
model = gtk_list_store_new (1, G_TYPE_STRING);
|
|
|
|
filesel->dir_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
|
|
|
g_object_unref (model);
|
|
|
|
|
2002-02-01 17:41:47 +00:00
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Folders"),
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_cell_renderer_text_new (),
|
|
|
|
"text", DIR_COLUMN,
|
|
|
|
NULL);
|
2002-02-01 17:41:47 +00:00
|
|
|
label = gtk_label_new_with_mnemonic (_("Fol_ders"));
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), filesel->dir_list);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_tree_view_column_set_widget (column, label);
|
|
|
|
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->dir_list), column);
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
gtk_widget_set_size_request (filesel->dir_list,
|
|
|
|
DIR_LIST_WIDTH, DIR_LIST_HEIGHT);
|
2002-01-29 20:53:17 +00:00
|
|
|
g_signal_connect (filesel->dir_list, "row_activated",
|
|
|
|
G_CALLBACK (gtk_file_selection_dir_activate), filesel);
|
|
|
|
|
|
|
|
/* gtk_clist_column_titles_passive (GTK_CLIST (filesel->dir_list)); */
|
1998-11-05 15:44:22 +00:00
|
|
|
|
|
|
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
|
1998-11-05 15:44:22 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_win), filesel->dir_list);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
|
|
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
2002-03-04 16:04:31 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 0);
|
2002-03-03 05:41:28 +00:00
|
|
|
if (GTK_IS_PANED (list_container))
|
|
|
|
gtk_paned_pack1 (GTK_PANED (list_container), scrolled_win, TRUE, TRUE);
|
|
|
|
else
|
|
|
|
gtk_container_add (GTK_CONTAINER (list_container), scrolled_win);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (filesel->dir_list);
|
1998-11-05 15:44:22 +00:00
|
|
|
gtk_widget_show (scrolled_win);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
/* The files list */
|
|
|
|
model = gtk_list_store_new (1, G_TYPE_STRING);
|
|
|
|
filesel->file_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
|
|
|
g_object_unref (model);
|
|
|
|
|
|
|
|
column = gtk_tree_view_column_new_with_attributes (_("Files"),
|
|
|
|
gtk_cell_renderer_text_new (),
|
|
|
|
"text", FILE_COLUMN,
|
|
|
|
NULL);
|
|
|
|
label = gtk_label_new_with_mnemonic (_("_Files"));
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), filesel->file_list);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_tree_view_column_set_widget (column, label);
|
|
|
|
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->file_list), column);
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
gtk_widget_set_size_request (filesel->file_list,
|
|
|
|
FILE_LIST_WIDTH, FILE_LIST_HEIGHT);
|
2002-01-29 20:53:17 +00:00
|
|
|
g_signal_connect (filesel->file_list, "row_activated",
|
|
|
|
G_CALLBACK (gtk_file_selection_file_activate), filesel);
|
|
|
|
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (filesel->file_list)), "changed",
|
|
|
|
G_CALLBACK (gtk_file_selection_file_changed), filesel);
|
|
|
|
|
|
|
|
/* gtk_clist_column_titles_passive (GTK_CLIST (filesel->file_list)); */
|
1998-11-05 15:44:22 +00:00
|
|
|
|
|
|
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
|
1998-11-05 15:44:22 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_win), filesel->file_list);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
|
|
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
2002-03-04 16:04:31 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 0);
|
2002-03-03 05:41:28 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (list_container), scrolled_win);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (filesel->file_list);
|
1998-11-05 15:44:22 +00:00
|
|
|
gtk_widget_show (scrolled_win);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-06 05:03:15 +00:00
|
|
|
/* action area for packing buttons into. */
|
|
|
|
filesel->action_area = gtk_hbox_new (TRUE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), filesel->action_area,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (filesel->action_area);
|
|
|
|
|
|
|
|
/* The OK/Cancel button area */
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-11-02 20:02:44 +00:00
|
|
|
/* The Cancel button */
|
|
|
|
filesel->cancel_button = gtk_dialog_add_button (dialog,
|
|
|
|
GTK_STOCK_CANCEL,
|
|
|
|
GTK_RESPONSE_CANCEL);
|
1997-11-24 22:37:52 +00:00
|
|
|
/* The OK button */
|
Derive from GtkDialog, and use stock buttons. Should be 100% source
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
2000-11-06 16:44:01 +00:00
|
|
|
filesel->ok_button = gtk_dialog_add_button (dialog,
|
2001-05-25 20:41:46 +00:00
|
|
|
GTK_STOCK_OK,
|
Derive from GtkDialog, and use stock buttons. Should be 100% source
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
2000-11-06 16:44:01 +00:00
|
|
|
GTK_RESPONSE_OK);
|
2004-10-25 05:43:29 +00:00
|
|
|
|
|
|
|
gtk_dialog_set_alternative_button_order (dialog,
|
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_grab_default (filesel->ok_button);
|
|
|
|
|
|
|
|
/* The selection entry widget */
|
|
|
|
entry_vbox = gtk_vbox_new (FALSE, 2);
|
Derive from GtkDialog, and use stock buttons. Should be 100% source
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
2000-11-06 16:44:01 +00:00
|
|
|
gtk_box_pack_end (GTK_BOX (filesel->main_vbox), entry_vbox, FALSE, FALSE, 2);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (entry_vbox);
|
2001-09-19 00:49:52 +00:00
|
|
|
|
|
|
|
eventbox = gtk_event_box_new ();
|
1997-11-24 22:37:52 +00:00
|
|
|
filesel->selection_text = label = gtk_label_new ("");
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
2001-09-19 00:49:52 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (eventbox), label);
|
|
|
|
gtk_box_pack_start (GTK_BOX (entry_vbox), eventbox, FALSE, FALSE, 0);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (label);
|
2001-09-19 00:49:52 +00:00
|
|
|
gtk_widget_show (eventbox);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
filesel->selection_entry = gtk_entry_new ();
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (filesel->selection_entry, "key_press_event",
|
|
|
|
G_CALLBACK (gtk_file_selection_key_press), filesel);
|
|
|
|
g_signal_connect (filesel->selection_entry, "insert_text",
|
|
|
|
G_CALLBACK (gtk_file_selection_insert_text), NULL);
|
2002-10-25 19:57:48 +00:00
|
|
|
g_signal_connect_swapped (filesel->selection_entry, "changed",
|
|
|
|
G_CALLBACK (gtk_file_selection_update_fileops), filesel);
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect_swapped (filesel->selection_entry, "focus_in_event",
|
|
|
|
G_CALLBACK (grab_default),
|
|
|
|
filesel->ok_button);
|
|
|
|
g_signal_connect_swapped (filesel->selection_entry, "activate",
|
|
|
|
G_CALLBACK (gtk_button_clicked),
|
|
|
|
filesel->ok_button);
|
2002-10-25 19:57:48 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (entry_vbox), filesel->selection_entry, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (filesel->selection_entry);
|
|
|
|
|
2002-11-02 03:54:18 +00:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (filesel->selection_text),
|
|
|
|
filesel->selection_entry);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!cmpl_state_okay (filesel->cmpl_state))
|
|
|
|
{
|
|
|
|
gchar err_buf[256];
|
|
|
|
|
2002-12-15 01:49:01 +00:00
|
|
|
g_snprintf (err_buf, sizeof (err_buf), _("Folder unreadable: %s"), cmpl_strerror (cmpl_errno));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-12-15 20:31:26 +00:00
|
|
|
gtk_label_set_text (GTK_LABEL (filesel->selection_text), err_buf);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (filesel, "", FALSE, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_grab_focus (filesel->selection_entry);
|
2002-01-17 23:43:23 +00:00
|
|
|
|
|
|
|
gtk_widget_pop_composite_child ();
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2001-09-19 00:49:52 +00:00
|
|
|
static gchar *
|
|
|
|
uri_list_extract_first_uri (const gchar* uri_list)
|
|
|
|
{
|
|
|
|
const gchar *p, *q;
|
|
|
|
|
|
|
|
g_return_val_if_fail (uri_list != NULL, NULL);
|
|
|
|
|
|
|
|
p = uri_list;
|
|
|
|
/* We don't actually try to validate the URI according to RFC
|
|
|
|
* 2396, or even check for allowed characters - we just ignore
|
|
|
|
* comments and trim whitespace off the ends. We also
|
|
|
|
* allow LF delimination as well as the specified CRLF.
|
|
|
|
*
|
|
|
|
* We do allow comments like specified in RFC 2483.
|
|
|
|
*/
|
|
|
|
while (p)
|
|
|
|
{
|
|
|
|
if (*p != '#')
|
|
|
|
{
|
|
|
|
while (g_ascii_isspace(*p))
|
|
|
|
p++;
|
|
|
|
|
|
|
|
q = p;
|
|
|
|
while (*q && (*q != '\n') && (*q != '\r'))
|
|
|
|
q++;
|
|
|
|
|
|
|
|
if (q > p)
|
|
|
|
{
|
|
|
|
q--;
|
|
|
|
while (q > p && g_ascii_isspace (*q))
|
|
|
|
q--;
|
|
|
|
|
|
|
|
if (q > p)
|
|
|
|
return g_strndup (p, q - p + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p = strchr (p, '\n');
|
|
|
|
if (p)
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dnd_really_drop (GtkWidget *dialog, gint response_id, GtkFileSelection *fs)
|
|
|
|
{
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
if (response_id == GTK_RESPONSE_YES)
|
|
|
|
{
|
|
|
|
filename = g_object_get_data (G_OBJECT (dialog), "gtk-fs-dnd-filename");
|
|
|
|
|
|
|
|
gtk_file_selection_set_filename (fs, filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
filenames_dropped (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint info,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
char *uri = NULL;
|
|
|
|
char *filename = NULL;
|
|
|
|
char *hostname;
|
2005-07-08 14:35:31 +00:00
|
|
|
const char *this_hostname;
|
2001-09-19 00:49:52 +00:00
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
if (!selection_data->data)
|
|
|
|
return;
|
|
|
|
|
|
|
|
uri = uri_list_extract_first_uri ((char *)selection_data->data);
|
|
|
|
|
|
|
|
if (!uri)
|
|
|
|
return;
|
|
|
|
|
|
|
|
filename = g_filename_from_uri (uri, &hostname, &error);
|
|
|
|
g_free (uri);
|
|
|
|
|
|
|
|
if (!filename)
|
|
|
|
{
|
|
|
|
g_warning ("Error getting dropped filename: %s\n",
|
|
|
|
error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-07-08 14:35:31 +00:00
|
|
|
this_hostname = g_get_host_name ();
|
2001-09-19 00:49:52 +00:00
|
|
|
|
|
|
|
if ((hostname == NULL) ||
|
2005-07-08 14:35:31 +00:00
|
|
|
(strcmp (hostname, this_hostname) == 0) ||
|
2001-09-19 00:49:52 +00:00
|
|
|
(strcmp (hostname, "localhost") == 0))
|
|
|
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (widget),
|
|
|
|
filename);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
2002-06-13 16:32:32 +00:00
|
|
|
gchar *filename_utf8;
|
|
|
|
|
|
|
|
/* Conversion back to UTF-8 should always succeed for the result
|
|
|
|
* of g_filename_from_uri()
|
|
|
|
*/
|
|
|
|
filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
|
|
|
|
g_assert (filename_utf8);
|
2001-09-19 00:49:52 +00:00
|
|
|
|
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (widget),
|
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
GTK_MESSAGE_QUESTION,
|
|
|
|
GTK_BUTTONS_YES_NO,
|
2002-04-14 12:36:12 +00:00
|
|
|
_("The file \"%s\" resides on another machine (called %s) and may not be available to this program.\n"
|
2002-06-13 16:32:32 +00:00
|
|
|
"Are you sure that you want to select it?"), filename_utf8, hostname);
|
|
|
|
g_free (filename_utf8);
|
2001-09-19 00:49:52 +00:00
|
|
|
|
2005-09-01 05:11:46 +00:00
|
|
|
g_object_set_data_full (G_OBJECT (dialog), I_("gtk-fs-dnd-filename"), g_strdup (filename), g_free);
|
2001-09-19 00:49:52 +00:00
|
|
|
|
|
|
|
g_signal_connect_data (dialog, "response",
|
|
|
|
(GCallback) dnd_really_drop,
|
|
|
|
widget, NULL, 0);
|
|
|
|
|
|
|
|
gtk_widget_show (dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (hostname);
|
|
|
|
g_free (filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
TARGET_URILIST,
|
|
|
|
TARGET_UTF8_STRING,
|
|
|
|
TARGET_STRING,
|
|
|
|
TARGET_TEXT,
|
|
|
|
TARGET_COMPOUND_TEXT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
filenames_drag_get (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint info,
|
|
|
|
guint time,
|
|
|
|
GtkFileSelection *filesel)
|
|
|
|
{
|
2001-10-23 16:02:23 +00:00
|
|
|
const gchar *file;
|
2001-09-19 00:49:52 +00:00
|
|
|
gchar *uri_list;
|
2005-07-08 14:35:31 +00:00
|
|
|
const char *hostname;
|
2001-09-19 00:49:52 +00:00
|
|
|
GError *error;
|
|
|
|
|
|
|
|
file = gtk_file_selection_get_filename (filesel);
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
{
|
|
|
|
if (info == TARGET_URILIST)
|
|
|
|
{
|
2005-07-08 14:35:31 +00:00
|
|
|
hostname = g_get_host_name ();
|
2001-09-19 00:49:52 +00:00
|
|
|
|
|
|
|
error = NULL;
|
2005-07-08 14:35:31 +00:00
|
|
|
uri_list = g_filename_to_uri (file, hostname, &error);
|
2001-09-19 00:49:52 +00:00
|
|
|
if (!uri_list)
|
|
|
|
{
|
|
|
|
g_warning ("Error getting filename: %s\n",
|
|
|
|
error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_selection_data_set (selection_data,
|
|
|
|
selection_data->target, 8,
|
|
|
|
(void *)uri_list, strlen((char *)uri_list));
|
|
|
|
g_free (uri_list);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-06-13 16:32:32 +00:00
|
|
|
gchar *filename_utf8 = g_filename_to_utf8 (file, -1, NULL, NULL, NULL);
|
|
|
|
g_assert (filename_utf8);
|
|
|
|
gtk_selection_data_set_text (selection_data, filename_utf8, -1);
|
|
|
|
g_free (filename_utf8);
|
2001-09-19 00:49:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_selection_setup_dnd (GtkFileSelection *filesel)
|
|
|
|
{
|
|
|
|
GtkWidget *eventbox;
|
2002-12-10 21:39:53 +00:00
|
|
|
static const GtkTargetEntry drop_types[] = {
|
2001-09-19 00:49:52 +00:00
|
|
|
{ "text/uri-list", 0, TARGET_URILIST}
|
|
|
|
};
|
2005-03-01 06:25:55 +00:00
|
|
|
static const gint n_drop_types = sizeof(drop_types)/sizeof(drop_types[0]);
|
2002-12-10 21:39:53 +00:00
|
|
|
static const GtkTargetEntry drag_types[] = {
|
2001-09-19 00:49:52 +00:00
|
|
|
{ "text/uri-list", 0, TARGET_URILIST},
|
|
|
|
{ "UTF8_STRING", 0, TARGET_UTF8_STRING },
|
|
|
|
{ "STRING", 0, 0 },
|
|
|
|
{ "TEXT", 0, 0 },
|
|
|
|
{ "COMPOUND_TEXT", 0, 0 }
|
|
|
|
};
|
2005-03-01 06:25:55 +00:00
|
|
|
static const gint n_drag_types = sizeof(drag_types)/sizeof(drag_types[0]);
|
2001-09-19 00:49:52 +00:00
|
|
|
|
|
|
|
gtk_drag_dest_set (GTK_WIDGET (filesel),
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
|
|
|
drop_types, n_drop_types,
|
|
|
|
GDK_ACTION_COPY);
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (filesel, "drag_data_received",
|
|
|
|
G_CALLBACK (filenames_dropped), NULL);
|
2001-09-19 00:49:52 +00:00
|
|
|
|
|
|
|
eventbox = gtk_widget_get_parent (filesel->selection_text);
|
|
|
|
gtk_drag_source_set (eventbox,
|
|
|
|
GDK_BUTTON1_MASK,
|
|
|
|
drag_types, n_drag_types,
|
|
|
|
GDK_ACTION_COPY);
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (eventbox, "drag_data_get",
|
|
|
|
G_CALLBACK (filenames_drag_get), filesel);
|
2001-09-19 00:49:52 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidget*
|
|
|
|
gtk_file_selection_new (const gchar *title)
|
|
|
|
{
|
|
|
|
GtkFileSelection *filesel;
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
filesel = g_object_new (GTK_TYPE_FILE_SELECTION, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_window_set_title (GTK_WINDOW (filesel), title);
|
2001-03-12 15:39:19 +00:00
|
|
|
gtk_dialog_set_has_separator (GTK_DIALOG (filesel), FALSE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-09-19 00:49:52 +00:00
|
|
|
file_selection_setup_dnd (filesel);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return GTK_WIDGET (filesel);
|
|
|
|
}
|
|
|
|
|
1998-03-06 05:03:15 +00:00
|
|
|
void
|
|
|
|
gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
|
|
|
|
|
|
|
|
/* delete, create directory, and rename */
|
|
|
|
if (!filesel->fileop_c_dir)
|
|
|
|
{
|
2002-02-01 17:41:47 +00:00
|
|
|
filesel->fileop_c_dir = gtk_button_new_with_mnemonic (_("_New Folder"));
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (filesel->fileop_c_dir, "clicked",
|
|
|
|
G_CALLBACK (gtk_file_selection_create_dir),
|
|
|
|
filesel);
|
1998-03-06 05:03:15 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (filesel->button_area),
|
|
|
|
filesel->fileop_c_dir, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (filesel->fileop_c_dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!filesel->fileop_del_file)
|
|
|
|
{
|
2002-01-29 20:53:17 +00:00
|
|
|
filesel->fileop_del_file = gtk_button_new_with_mnemonic (_("De_lete File"));
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (filesel->fileop_del_file, "clicked",
|
|
|
|
G_CALLBACK (gtk_file_selection_delete_file),
|
|
|
|
filesel);
|
1998-03-06 05:03:15 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (filesel->button_area),
|
|
|
|
filesel->fileop_del_file, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (filesel->fileop_del_file);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!filesel->fileop_ren_file)
|
|
|
|
{
|
2002-01-29 20:53:17 +00:00
|
|
|
filesel->fileop_ren_file = gtk_button_new_with_mnemonic (_("_Rename File"));
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (filesel->fileop_ren_file, "clicked",
|
|
|
|
G_CALLBACK (gtk_file_selection_rename_file),
|
|
|
|
filesel);
|
1998-03-06 05:03:15 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (filesel->button_area),
|
|
|
|
filesel->fileop_ren_file, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (filesel->fileop_ren_file);
|
|
|
|
}
|
2002-10-25 19:57:48 +00:00
|
|
|
|
|
|
|
gtk_file_selection_update_fileops (filesel);
|
|
|
|
|
2001-03-23 23:39:24 +00:00
|
|
|
g_object_notify (G_OBJECT (filesel), "show_fileops");
|
1998-03-06 05:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_file_selection_hide_fileop_buttons (GtkFileSelection *filesel)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
|
|
|
|
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
if (filesel->fileop_ren_file)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (filesel->fileop_ren_file);
|
|
|
|
filesel->fileop_ren_file = NULL;
|
|
|
|
}
|
1998-03-06 05:03:15 +00:00
|
|
|
|
|
|
|
if (filesel->fileop_del_file)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (filesel->fileop_del_file);
|
|
|
|
filesel->fileop_del_file = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (filesel->fileop_c_dir)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (filesel->fileop_c_dir);
|
|
|
|
filesel->fileop_c_dir = NULL;
|
|
|
|
}
|
2001-03-23 23:39:24 +00:00
|
|
|
g_object_notify (G_OBJECT (filesel), "show_fileops");
|
1998-03-06 05:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-06-13 16:32:32 +00:00
|
|
|
/**
|
|
|
|
* gtk_file_selection_set_filename:
|
|
|
|
* @filesel: a #GtkFileSelection.
|
|
|
|
* @filename: a string to set as the default file name.
|
|
|
|
*
|
|
|
|
* Sets a default path for the file requestor. If @filename includes a
|
|
|
|
* directory path, then the requestor will open with that path as its
|
|
|
|
* current working directory.
|
|
|
|
*
|
2003-05-22 00:25:50 +00:00
|
|
|
* This has the consequence that in order to open the requestor with a
|
|
|
|
* working directory and an empty filename, @filename must have a trailing
|
|
|
|
* directory separator.
|
|
|
|
*
|
2004-12-12 21:09:13 +00:00
|
|
|
* The encoding of @filename is preferred GLib file name encoding, which
|
2002-06-13 16:32:32 +00:00
|
|
|
* may not be UTF-8. See g_filename_from_utf8().
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_file_selection_set_filename (GtkFileSelection *filesel,
|
|
|
|
const gchar *filename)
|
|
|
|
{
|
2000-02-03 01:19:03 +00:00
|
|
|
gchar *buf;
|
1997-11-24 22:37:52 +00:00
|
|
|
const char *name, *last_slash;
|
2002-06-13 16:32:32 +00:00
|
|
|
char *filename_utf8;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
|
|
|
|
g_return_if_fail (filename != NULL);
|
|
|
|
|
2002-06-13 16:32:32 +00:00
|
|
|
filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
|
2002-06-16 03:12:05 +00:00
|
|
|
g_return_if_fail (filename_utf8 != NULL);
|
2002-06-13 16:32:32 +00:00
|
|
|
|
2002-06-16 03:58:44 +00:00
|
|
|
last_slash = strrchr (filename_utf8, G_DIR_SEPARATOR);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (!last_slash)
|
|
|
|
{
|
2000-02-03 01:19:03 +00:00
|
|
|
buf = g_strdup ("");
|
2002-06-16 03:58:44 +00:00
|
|
|
name = filename_utf8;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-06-16 03:58:44 +00:00
|
|
|
buf = g_strdup (filename_utf8);
|
|
|
|
buf[last_slash - filename_utf8 + 1] = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
name = last_slash + 1;
|
|
|
|
}
|
|
|
|
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (filesel, buf, FALSE, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (filesel->selection_entry)
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), name);
|
2000-02-03 01:19:03 +00:00
|
|
|
g_free (buf);
|
2001-03-23 23:39:24 +00:00
|
|
|
g_object_notify (G_OBJECT (filesel), "filename");
|
2002-06-13 16:32:32 +00:00
|
|
|
|
|
|
|
g_free (filename_utf8);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2001-03-23 23:39:24 +00:00
|
|
|
/**
|
|
|
|
* gtk_file_selection_get_filename:
|
|
|
|
* @filesel: a #GtkFileSelection
|
|
|
|
*
|
2004-12-12 21:09:13 +00:00
|
|
|
* This function returns the selected filename in the GLib file name
|
|
|
|
* encoding. To convert to UTF-8, call g_filename_to_utf8(). The
|
|
|
|
* returned string points to a statically allocated buffer and should
|
|
|
|
* be copied if you plan to keep it around.
|
2002-04-30 18:15:35 +00:00
|
|
|
*
|
|
|
|
* If no file is selected then the selected directory path is returned.
|
2001-03-23 23:39:24 +00:00
|
|
|
*
|
2002-04-30 18:15:35 +00:00
|
|
|
* Return value: currently-selected filename in the on-disk encoding.
|
2001-03-23 23:39:24 +00:00
|
|
|
**/
|
|
|
|
G_CONST_RETURN gchar*
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_file_selection_get_filename (GtkFileSelection *filesel)
|
|
|
|
{
|
2002-12-10 21:39:53 +00:00
|
|
|
static const gchar nothing[2] = "";
|
2006-04-01 20:06:15 +00:00
|
|
|
static GString *something;
|
2000-08-12 07:37:27 +00:00
|
|
|
char *sys_filename;
|
2001-10-23 16:02:23 +00:00
|
|
|
const char *text;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_FILE_SELECTION (filesel), nothing);
|
|
|
|
|
1999-10-06 19:47:24 +00:00
|
|
|
#ifdef G_WITH_CYGWIN
|
2000-08-12 07:25:55 +00:00
|
|
|
translate_win32_path (filesel);
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
text = gtk_entry_get_text (GTK_ENTRY (filesel->selection_entry));
|
|
|
|
if (text)
|
|
|
|
{
|
2003-08-01 21:20:21 +00:00
|
|
|
gchar *fullname = cmpl_completion_fullname (text, filesel->cmpl_state);
|
|
|
|
sys_filename = g_filename_from_utf8 (fullname, -1, NULL, NULL, NULL);
|
|
|
|
g_free (fullname);
|
2001-03-26 13:51:10 +00:00
|
|
|
if (!sys_filename)
|
2001-03-12 15:39:19 +00:00
|
|
|
return nothing;
|
2006-04-01 20:06:15 +00:00
|
|
|
if (!something)
|
|
|
|
something = g_string_new (sys_filename);
|
|
|
|
else
|
|
|
|
g_string_assign (something, sys_filename);
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_filename);
|
2006-04-01 20:06:15 +00:00
|
|
|
|
|
|
|
return something->str;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nothing;
|
|
|
|
}
|
|
|
|
|
1998-10-22 00:54:57 +00:00
|
|
|
void
|
|
|
|
gtk_file_selection_complete (GtkFileSelection *filesel,
|
|
|
|
const gchar *pattern)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
|
|
|
|
g_return_if_fail (pattern != NULL);
|
|
|
|
|
|
|
|
if (filesel->selection_entry)
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), pattern);
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (filesel, (gchar*) pattern, TRUE, TRUE);
|
1998-10-22 00:54:57 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_file_selection_destroy (GtkObject *object)
|
|
|
|
{
|
|
|
|
GtkFileSelection *filesel;
|
1998-01-21 09:06:05 +00:00
|
|
|
GList *list;
|
|
|
|
HistoryCallbackArg *callback_arg;
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (object));
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
filesel = GTK_FILE_SELECTION (object);
|
1998-01-21 09:06:05 +00:00
|
|
|
|
|
|
|
if (filesel->fileop_dialog)
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
{
|
|
|
|
gtk_widget_destroy (filesel->fileop_dialog);
|
|
|
|
filesel->fileop_dialog = NULL;
|
|
|
|
}
|
1998-01-21 09:06:05 +00:00
|
|
|
|
1998-02-02 18:44:28 +00:00
|
|
|
if (filesel->history_list)
|
|
|
|
{
|
|
|
|
list = filesel->history_list;
|
|
|
|
while (list)
|
|
|
|
{
|
|
|
|
callback_arg = list->data;
|
|
|
|
g_free (callback_arg->directory);
|
1998-03-24 05:27:00 +00:00
|
|
|
g_free (callback_arg);
|
1998-02-02 18:44:28 +00:00
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
g_list_free (filesel->history_list);
|
|
|
|
filesel->history_list = NULL;
|
1998-01-21 09:06:05 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
if (filesel->cmpl_state)
|
|
|
|
{
|
|
|
|
cmpl_free_state (filesel->cmpl_state);
|
|
|
|
filesel->cmpl_state = NULL;
|
|
|
|
}
|
2002-02-17 00:07:48 +00:00
|
|
|
|
|
|
|
if (filesel->selected_names)
|
|
|
|
{
|
|
|
|
free_selected_names (filesel->selected_names);
|
|
|
|
filesel->selected_names = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (filesel->last_selected)
|
|
|
|
{
|
|
|
|
g_free (filesel->last_selected);
|
|
|
|
filesel->last_selected = NULL;
|
|
|
|
}
|
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2002-01-17 00:53:50 +00:00
|
|
|
static void
|
|
|
|
gtk_file_selection_map (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkFileSelection *filesel = GTK_FILE_SELECTION (widget);
|
|
|
|
|
|
|
|
/* Refresh the contents */
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (filesel, "", FALSE, FALSE);
|
2002-01-17 00:53:50 +00:00
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
|
|
|
}
|
|
|
|
|
2001-10-23 16:02:23 +00:00
|
|
|
static void
|
|
|
|
gtk_file_selection_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkFileSelection *filesel = GTK_FILE_SELECTION (object);
|
|
|
|
|
|
|
|
g_free (filesel->fileop_file);
|
2001-11-03 20:47:50 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-10-23 16:02:23 +00:00
|
|
|
}
|
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
/* Begin file operations callbacks */
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_file_selection_fileop_error (GtkFileSelection *fs,
|
|
|
|
gchar *error_message)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
2001-03-12 15:39:19 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
g_return_if_fail (error_message != NULL);
|
|
|
|
|
2001-03-12 15:39:19 +00:00
|
|
|
/* main dialog */
|
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (fs),
|
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
GTK_MESSAGE_ERROR,
|
2004-03-11 18:48:46 +00:00
|
|
|
GTK_BUTTONS_OK,
|
2001-03-12 15:39:19 +00:00
|
|
|
"%s", error_message);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
/* yes, we free it */
|
|
|
|
g_free (error_message);
|
2001-03-12 15:39:19 +00:00
|
|
|
|
|
|
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
2002-01-29 20:53:17 +00:00
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect_swapped (dialog, "response",
|
|
|
|
G_CALLBACK (gtk_widget_destroy),
|
|
|
|
dialog);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
gtk_widget_show (dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_file_selection_fileop_destroy (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
|
|
|
GtkFileSelection *fs = data;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
|
|
|
|
|
|
fs->fileop_dialog = NULL;
|
|
|
|
}
|
|
|
|
|
2002-10-25 19:57:48 +00:00
|
|
|
static gboolean
|
|
|
|
entry_is_empty (GtkEntry *entry)
|
|
|
|
{
|
|
|
|
const gchar *text = gtk_entry_get_text (entry);
|
|
|
|
|
|
|
|
return *text == '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_file_selection_fileop_entry_changed (GtkEntry *entry,
|
|
|
|
GtkWidget *button)
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive (button, !entry_is_empty (entry));
|
|
|
|
}
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_file_selection_create_dir_confirmed (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
|
|
|
GtkFileSelection *fs = data;
|
2001-10-23 16:02:23 +00:00
|
|
|
const gchar *dirname;
|
1998-01-21 07:53:07 +00:00
|
|
|
gchar *path;
|
|
|
|
gchar *full_path;
|
2000-08-12 07:37:27 +00:00
|
|
|
gchar *sys_full_path;
|
1998-01-21 07:53:07 +00:00
|
|
|
gchar *buf;
|
2001-03-12 15:39:19 +00:00
|
|
|
GError *error = NULL;
|
1998-01-21 07:53:07 +00:00
|
|
|
CompletionState *cmpl_state;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
|
|
|
|
|
|
dirname = gtk_entry_get_text (GTK_ENTRY (fs->fileop_entry));
|
|
|
|
cmpl_state = (CompletionState*) fs->cmpl_state;
|
|
|
|
path = cmpl_reference_position (cmpl_state);
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
full_path = g_strconcat (path, G_DIR_SEPARATOR_S, dirname, NULL);
|
2001-03-12 15:39:19 +00:00
|
|
|
sys_full_path = g_filename_from_utf8 (full_path, -1, NULL, NULL, &error);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
if (g_error_matches (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
|
2002-02-01 17:41:47 +00:00
|
|
|
buf = g_strdup_printf (_("The folder name \"%s\" contains symbols that are not allowed in filenames"), dirname);
|
2001-03-12 15:39:19 +00:00
|
|
|
else
|
2002-02-01 17:41:47 +00:00
|
|
|
buf = g_strdup_printf (_("Error creating folder \"%s\": %s\n%s"), dirname, error->message,
|
2001-03-12 15:39:19 +00:00
|
|
|
_("You probably used symbols not allowed in filenames."));
|
|
|
|
gtk_file_selection_fileop_error (fs, buf);
|
|
|
|
g_error_free (error);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2004-12-12 21:09:13 +00:00
|
|
|
if (g_mkdir (sys_full_path, 0777) < 0)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
2002-02-01 17:41:47 +00:00
|
|
|
buf = g_strdup_printf (_("Error creating folder \"%s\": %s\n"), dirname,
|
2001-03-12 15:39:19 +00:00
|
|
|
g_strerror (errno));
|
Adapt cast macros to standard.
Fri Nov 19 10:34:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkgamma.h: Adapt cast macros to standard.
[ Merges from 1.2 ]
Tue Nov 16 10:15:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_path):
If translation does not include a '/', use entire
translation instead of crashing.
Sun Oct 31 22:21:11 1999 Tim Janik <timj@gtk.org>
* docs/gtk_tut.sgml:
s/gtk_accel_group_attach/gtk_window_add_accel_group/.
Sat Oct 30 09:09:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_remove): Use
g_list_remove_link, not g_list_remove.
[ From Geert Bevin <gbevin@thunderstorms.org> ]
Sun Oct 24 07:41:40 1999 Tim Janik <timj@gtk.org>
* gtk/gtkclist.c (real_undo_selection): commented out g_print()
statement upon unselection (how the heck did that slip in?).
Sat Oct 23 03:03:08 1999 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (gtk_text_freeze):
(gtk_text_thaw): undraw/draw cursor here to avoid unnecessary scrolling
in frozen state (and aparently crashes). patch provided by Anders
Melchiorsen <and@kampsax.dtu.dk>.
Sat Oct 23 02:53:20 1999 Tim Janik <timj@gtk.org>
* fix insensitive default/focus widget activation,
reported by Matt Goodall <mgg@isotek.co.uk>.
* gtk/gtkwindow.c (gtk_window_key_press_event):
(gtk_window_activate_default):
(gtk_window_activate_focus):
return handled=FALSE for actiavtion of insensitive default
widgets. return handled=TRUE for activation of insensitive
focus widgets. don't activate in either case.
Tue Oct 19 09:55:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk-config.in (lib_gtk): Switch order of @x_cflags@
and $glib_cflags to match library order and in the
theory that an old version of GLib is more likely to
be in the include directory for X then vice-versa.
(Bug #2776)
Tue Oct 19 09:46:49 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Always use LC_CTYPE
to determine the locale for fontsets, not LC_MESSAGES;
the user may want English messages with a handling
for non-English languages. (LC_CTYPE=ru_RU LC_MESSAGES=fr_FR
will still be broken) (Bug #2891)
Tue Oct 19 20:36:42 1999 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
* gtk/gtkrc.ko: Fixed the wrong number of "*"'s.
Tue Oct 19 12:15:13 1999 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
* gtk/gtkrc.ko: Changed the Korean default fontset.
Fri Oct 8 02:32:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): Fix bug
where when scrolling to the left or top double exposes
were done, causing major slowdowns.
Thu Oct 7 18:31:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Always normalize codeset
names to lowercase and alphanumeric, before looking
them up.
* gtk/Makefile.am: Install codeset variant gtkrc files
with normalized names.
Thu Oct 7 22:52:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_popup_with_data): even
popup menus when the menu is already visible, but its parent
is still hidden, (happens after tornoff window got hidden).
Thu Oct 7 11:09:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (install-data-local): Fix
a typo where gtkrc.vi_VN.tcvn5712 wasn't getting
deleted, causing error messages on install.
Thu Oct 7 11:03:06 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtk[hv]paned.c (gtk_{h,v}paned_draw): Redraw
the handle as well, since we now sometimes ignore
exposes on the handle while resizing.
Wed Oct 6 18:02:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_append_default_pixmap_path): Fix stupid
extra g_free introduced in one of the last one or two
commits.
Wed Oct 6 16:38:36 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am gtk/gtkrc*: Make naming of gtkrc files
consistent, put each style that a gtkrc.* file creates
in a unique namespace, remove old files before installing.
Wed Oct 6 14:31:16 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Avoid leaking memory when
gtk_rc_init is called multiple times. (Yes, people who
do that have bugs in their code.)
Tue Oct 5 11:36:57 PDT 1999 Manish Singh <yosh@gimp.org>
* gtk/Makefile.am: listing gtkrc in gtkconf_DATA seems to barf.
Remove it since it's generated by the Makefile anyway
Tue Oct 5 02:43:41 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkinputcommon.h (gdk_input_device_new): Free
device->info.axes for core pointer.
Thu Sep 30 13:55:25 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (destroy_idle_test): Rename idle to
idle_id, to deal with obsolete, broken C libraries.
Mon Sep 27 02:50:15 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkvscale.c (gtk_vscale_draw): Don't add in
allocation->x/y twice!
* gtk/gtkhscale.c: Make usage of gtk_hscale_pos_trough()
consistent with gtk_vscale_pos_trough().
Sun Sep 26 19:44:34 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcontainer.c (gtk_container_queue_resize): We may
be queueing a resize on a toplevel container between
the time we show it and when we map it. So, we need
to test GTK_WIDGET_VISIBLE() for toplevels, and only
use GTK_WIDGET_DRAWABLE() for child windows.
Thu Sep 23 16:41:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDADDS): Add GDK_WLIBS to LDADDS
(fixes bug #2144)
Fri Sep 24 00:51:45 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_queue_resize): check for
container DRAWABLE (instead of VISIBLE), so we don't queue
resizes on non-toplevel containers.
Sun Sep 19 18:13:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.[ch]: Make the data argument
const guchar *.
Sat Sep 18 21:27:40 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c: Try to behave sensibly if
the focus widget is the window itself. (Should
we allow this at all?)
Fri Sep 17 09:57:15 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_set_sensitive):
* gtk/gtknotebook.c (gtk_notebook_set_scrollable):
* gtk/gtknotebook.c (gtk_notebook_set_show_border):
* gtk/gtkclist.c (gtk_notebook_set_show_border): make gboolean args
in prototypes and implementations consistent (Tomas Ogren).
* gtk/gtklayout.c (gtk_layout_remove): unset GTK_IS_OFFSCREEN flag
before the widget is unparented (reported by damon).
* gtk/gtkdnd.c: make the cursor and icon data _unsigned_ char,
since we provide unsigned data anyways.
Thu Sep 16 21:32:01 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c (gtk_tooltips_set_tip): Delay
the call to gtk_tooltips_layout_text() until later.
* gtk/gtktooltips.c (gtk_tooltips_draw_tips):
Call gtk_widget_ensure_style() before using the style.
Wed Sep 15 02:52:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_event): Added workaround
for old widgets that don't propagate draws to all
children. (Namely gnome-dock for gnome-libs <= 1.0.16)
Tue Sep 14 19:22:19 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): don't queue the parent
for a redraw but just the widget that requested the resize.
Tue Sep 14 18:29:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: added new widget level method
gtk_container_set_reallocate_redraws() and a GtkContainer flag
reallocate_redraws : 1 to reflect the setting, exported this through
the argument system as a boolean ::reallocate_redraws.
* gtk/gtkwidget.c (gtk_widget_size_allocate): when queueing redraws
on the widget because the allocation changes, do so as well for
widget->parent if the parent has reallocate_redraws set to TRUE.
with that containers requesting reallocation redraws get automatically
redrawn if their children changed allocation (this unfortunately
affects also other children that didn't change allocation, but we
cannot work around that before 1.3).
Tue Sep 14 18:23:01 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_idle_draw): only emit ::draw if width
_and_ height are >0 (not _or_).
* gtk/gtktable.c (gtk_table_remove): use gtk_widget_queue_resize()
instead of gtk_container_queue_resize(), which is a core gtk internal
function (must have been on crack when i queued that).
* gtk/gtkprivate.h: added new private flag GTK_FULLDRAW_PENDING, so
we can check more reliably if we want to discard expose events.
* gtk/gtkwidget.c: added setting/unsetting of the GTK_FULLDRAW_PENDING
flag.
* gtk/gtkwidget.c (gtk_widget_event): don't discard synthesized exposes,
we simply trust these events. for deciding whether to discard exposes,
check GTK_FULLDRAW_PENDING instead of RESIZE_PENDING.
Mon Sep 13 15:01:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_queue_clear_area): Ignore
queues of areas that are completely off screen.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Fix broken
logic for handleboxes.
* gtk/gtkwidget.c (gtk_widget_queue_draw_data): Add santity
check on width/height.
Mon Sep 13 02:22:47 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am: backed out Raja's recent VPATH build "improvements",
we are fine with using $@ the way we do (if we actually encounter
brokeness with $@ in VPATH builds because of additional path prefixes,
we need to use $(@F) actually).
Mon Sep 13 01:34:53 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: renamed two variables, hopefully didn't introduce
short lived bugs, that would allow language bindings to do surgeries
to our guts.
Fri Sep 10 15:22:50 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_size_allocate): Fix typo
where comparison was being done against an uninitialized
value causing intermittant results depending on
compiler flags. Also make it clearer that we aren't
ever initializing the child as 0x0 (though this will
be caught in gtk_widget_size_allocate())
Fri Sep 10 10:06:56 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_set_transient_for): Move
gtk_window_unset_transient_for() call after we do checks
involving the old transient parent.
[ From Lance Capser <lmc@cyberhighway.net> ]
1999-09-07 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (gtk.defs): Go back to using `touch' to create
an empty file.
Mon Sep 6 00:11:56 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_is_ancestor): return FALSE if node has
no children. (Reported by: Chris Rogers <gandalf@pobox.com>)
1999-09-03 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (gen_sources): Improve VPATH builds.
`$@' is valid only in the build dir, not after we've done
`cd $srcdir'. Also use `test -f' instead of less portable
`test -e'.
Fri Sep 3 15:59:56 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (correct_cache_insert): Rewrite
for simplicity, and hopefully correctness.
(Fixes bug #1322, which was a segfault when
on some insertions with the properties around
the insertion set up just wrong.)
* gtk/gtktext.c (gtk_text_adjustment): When we receive
a "changed" signal, clamp the new value to the adjustment
bounds to avoid segfaulting if someone tries to change
the adjustment to a bogus value. (Bug #1795)
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness
problem that was causing background to sometimes
be misaligned.
Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
[ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
* gtk/gtkmenu.c (gtk_menu_position): Make
sure we never position menus with negative x, y,
since gtk_widget_set_uposition() can't handle that.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
Modify the positioning code a bit so that we always
put the top-left corner onscreen. (This is for
UI reasons, gtk_menu_position() now takes care of
gtk_widet_set_uposition() brokeness.)
Fri Sep 3 03:06:30 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am: fixed up things for -jx, x > 1.
Sun Sep 5 08:48:51 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_style): Ref the
RC style that is passed in. The lack of the ref
before was a bug. If people worked around this
bug, this will introduce a slight memory leak
in their code. The code should typically look like:
rc_style = gtk_rc_style_new ();
[...]
gtk_widget_modify_style (widget, rc_style);
gtk_rc_style_unref (rc_style);
* gtk/gtkwidget.c (gtk_widget_modify_style): Reset
the style if it was already set.
* gtk/gtkwidget.c (gtk_widget_set_name): Only set the
style if it was set before.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (main): Add a check to see if we
are being run from the correct directory and
to quit nicely if we are not.
* gtk/gtkrc.c (gtk_rc_slist_remove_all): Make function
static.
Thu Sep 2 23:00:03 1999 Tim Janik <timj@gtk.org>
* gtk/gtkenums.h (GtkWindowPosition): added GTK_WIN_POS_CENTER_ALWAYS.
* gtk/gtkwindow.c:
queue resizes unconditionally (gtk_widget_queue_resize will figure
what to do if the window is not realized).
(gtk_window_move_resize): only recenter the window
for GTK_WIN_POS_CENTER_ALWAYS.
(gtk_window_compute_reposition): handle GTK_WIN_POS_CENTER_ALWAYS in
the same way as GTK_WIN_POS_CENTER.
Thu Sep 2 22:39:27 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_reposition): check for the last position
with (!(info->last_flags & GDK_HINT_POS)) instead of
(!info->last_flags & GDK_HINT_POS).
* gtk/gtkwindow.c (gtk_window_move_resize): constrain new_width and
new_height unconditionally, because we use these values even if
!default_size_changed && !hints_changed.
comented the (default_size_changed || hints_changed) case with
respect to resize rejects from the window manager.
* gtk/gtkwindow.c (gtk_window_move_resize): save info->last values
in the zvt condition hack, since this includes the window hints, set
the hints after the handling_resize case.
* gtk/gtkwindow.c (gtk_window_show): constrain the default size that a
window is initially shown with to the geometry.
Thu Sep 2 07:38:56 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize):
s/size_changed/default_size_changed/g so i know what's
really going on (frying brain on smaller flame now).
Thu Sep 2 05:47:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize): queue a new resize if
we have size_changed upon handling_resize. this is a gross
workaround for the broken zvt widget and should be removed in
1.3 again (search for FIXME).
Owen provided an accurate comment for this:
/* We could be here for two reasons
* 1) We coincidentally got a resize while handling
* another resize.
* 2) Our computation of size_changed was completely
* screwed up, probably because one of our children
* is broken. It's probably a zvt widget.
*
* For 1), we could just go ahead and ask for the
* new size right now, but doing that for 2)
* might well be fighting the user (and can even
* trigger a loop). Since we really don't want to
* do that, we requeue a resize in hopes that
* by the time it gets handled, the child has seen
* the light and is willing to go along with the
* new size. (this happens for the zvt widget, since
* the size_allocate() above will have stored the
* requisition corresponding to the new size in the
* zvt widget)
*
* This doesn't buy us anything for 1), but it shouldn't
* hurt us too badly, since it is what would have
* happened if we had gotten the configure event before
* the new size had been set.
*/
Wed Sep 1 20:46:11 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: deal properly with the fact that RC
style lists may include rc styles more than once.
* gtk/gtkrc.c (gtk_rc_append_pixmap_path): Removed
unused static function.
* gtk/gtkrc.c (gtk_rc_find_pixmap_in_path): Keep a
stack of directories of RC files currently being
parsed and implicitely add them to pixmap path.
This fixes a bug where the directory would get
appended then overwritten by pixmap_path declarations.
(bug #1462, from Peter Wainright <prw@wainpr.demon.co.uk>)
* gtk/gtkthemes.c (gtk_theme_engine_unref): Call
theme's exit function. (Patch from Peter Wainwright,
bug #1454)
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_destroy):
Add a destroy() handler to take care of removing
group for menu item. (Fixes bug #1197)
* gtk/gtkwidget.c (gtk_widget_size_request): Fixed thinko
in warning message.
Wed Sep 1 21:27:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize): don't require a server
roundtrip to figure window's width and height, since we know that
anyways from widget->allocation.
Wed Sep 1 12:37:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Compute
the hints after we request the new size.
Wed Sep 1 10:38:37 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_compute_hints): Removed
GTK_WIDGET_REALIZED() assertion - we can compute the
hints before we are realized.
* gtk/gtkwindow.c (gtk_window_move_resize): Reorder
hint changing so that we have a value of hints_changed
when we decide whether to constrain the window size.
* gtk/gtkwindow.c (gtk_window_move_resize): Spelling fix.
* gtk/gtkwindow.c (gtk_window_constrain_size): cleanups,
change back to G_MAXINT.
Wed Sep 1 06:54:59 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_get_geometry_info): zero initialize
new GtkWindowGeometryInfo, so fields like GdkGeometry geometry
contain uncluttered values.
(gtk_window_compute_hints): simply assert that window is realized
and that geometry_info is valid, since we rely on this anyways.
(gtk_window_constrain_size): major cleanups to the code.
if (flags & GDK_HINT_BASE_SIZE) use geometry's base width and height
for the base size, instead of the minimums. use 32767 as max width
and height (like in gtkwindow.c) instead of G_MAXINT.
Wed Sep 1 04:41:25 1999 Tim Janik <timj@gtk.org>
* cleaned up the GtkContainer.need_resize flag handling mess, we
only need to force resize requests when we were prematurely
realized, or our widget tree was modified when we were temporarily
hidden. handling these cases directly upon showing the window (i.e.
while the GdkWindow is still unmapped) avoids the need to wait for
a configure event response and therefore makes the GUI more snappier
and avoids blank windows during the roundtrip.
* gtk/gtkwidget.c:
(gtk_widget_hide):
(gtk_widget_show): don't queue resizes on toplevels, they know how
to deal with matters.
* gtk/gtkcontainer.c (gtk_container_queue_resize): set the ->need_resize
flag directly for not visible resize containers and spare us unecessary
signal emissions.
* gtk/gtkwindow.c:
(gtk_window_realize): if we need to enforce premature size allocation,
queue a container resize so we are correctly resized later on.
(gtk_window_init):
(gtk_window_size_request):
don't freak around with the ->need_resize flag,
gtk_container_queue_resize() will care about that.
(gtk_window_show):
handle initial resizing issues here, we can handle matters better in
this place, especially since we know that our GdkWindow is still
unmapped.
(gtk_window_move_resize):
don't care about ->need_resize at all.
handle size changes properly that occoured while we waited for a
configure event.
Tue Aug 31 15:58:46 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_uposition):
* gtk/gtkwindow.[hc] (gtk_window_reposition):
Move the hint setting code from gtk_widget_set_uposition
to here; set the hints so that we respect any previously
set geometry hints.
* gtk/gtkwindow.c (gtk_window_compute_reposition): Don't
change the window hints here or move the window here,
let that happen in gtk_window_move_resize().
Tue Aug 31 06:58:52 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_event): when discarding exposes due
to already queued resizes (and therefore redraws) on a widget, check
its anchestry as well.
* gtk/gtkcontainer.c:
(gtk_container_queue_resize): clear resize widgets for resize
containers before aborting prematurely. this is especially important
for toplevels which may need imemdiate processing or their resize
handler to be queued.
(gtk_container_dequeue_resize_handler): added new internal function for
gtkwindow.c.
* gtk/gtkwindow.c (gtk_window_move_resize): if we are resizing due to a
configure event, take possible changes in window position into account
as well.
if we request a new window size, queue up a resize handler that will
last until the configure event response arrives.
combined the ->need_resize case (initial show) with the general size
(hints) changed case and added even more comments.
if !auto_shrink, only revert to the old allocation if the new size
is smaller than the current allocation.
Tue Aug 31 11:55:20 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_set_arg, gtk_window_set_policy,
gtk_window_set_geometry_hints
gtk_window_set_default_size):
When hints are set, queue a resize so that the hints will
be eventually reset on the toplevel.
* gtk/gtkwindow.c (gtk_window_show): Use
gtk_window_compute_default_size(). Clear the need_resize flag
on the initail map so that we don't unnecessarily trigger the
resize code.
* gtk/gtkwindow.c (gtk_window_move_resize): Split apart
into separate functions. Compare the hints we are setting
with what we set last time so that we can accurately
tell when we need to reset the hints.
* gtk/gtkwindow.c (gtk_window_compute_default_size): New
function to figure out the size from requisition
and default_size.
* gtk/gtkwindow.c (gtk_window_constrain_size): Function
from fvwm to constrain a size to the geometry hints.
* gtk/gtkwindow.c (gtk_window_compare_hints): New function
to compare two sets of geometry hints.
* gtk/gtkwindow.c (gtk_window_compute_hints): Renamed
from gtk_window_set_hints(), just compute the hints,
don't set them.
* gtk/gtkwindow.c (gtk_window_compute_reposition): Move
code from gtk_window_move_resize() to separate function,
rationalize a bit.
Tue Aug 31 13:05:03 1999 Owen Taylor <otaylor@redhat.com>
* gtkrc.h: Move the ref_count member out of the GtkRcStyle
structure into a new private structure.
* gtkrc.c: Split GtkRcStyle into public/private.
In the private part, add a list of pointers to the
RcStyle lists this RcStyle participates in.
* gtkrc.c: When a RcStyle is free, remove all
lists referencing it from the
realized_style_ht hash, and free those lists.
* gtk/gtkrc.c (gtk_rc_clear_styles): Don't call
gtk_rc_init(), since that adds the default styles
to the list of parsed RC files again.
* gtk/gtkrc.c: Use gtk_rc_style_find() consistently.
Thu Aug 26 14:14:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): reactivated the sanity
checks that ensure that a widget's allocation is at least 1 in width
and height. (GNOME note: this doesn't affect old panel code anymore,
because GtkSocket will request width and height of at least 1 since
Fri Jul 23).
* gtk/gtkwindow.c (gtk_window_realize): if the widget hasn't been
allocated yet (happens if the user realizes the window prematurely),
size request and allocate it.
(gtk_window_size_allocate): guard against guint underflows.
Wed Aug 25 19:01:36 1999 Lars Hamann <lars@gtk.org>
* gtk/Makefile.am (gtk_built_sources): reordered stamp-gtk.defs
in gtk_built_sources, so gtk.defs gets built prior to all other
sources.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am:
invoke indent on gtkmarshal.*.
rewrote source generation rules, use COPYING as oldest source tag for
a piggyback rule to generate all sources from (don't touch it ;).
major cleanups, strip spaces on build rules for GNU Make.
* gtk/genmarshal.pl: don't operate on hardcoded filenames but take
source and target files from commandline arguments. don't invoke indent.
Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_real_switch_page): queue_resize
notebook after switch to avoid drawing problems.
(Bug#856 Reported by: Theodore Roth <troth@netmagic.net>)
(gtk_notebook_pages_allocate): don't map not visible tab_labels,
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_real_switch_page): queue_resize
notebook after switch to avoid drawing problems.
(Bug#856 Reported by: Theodore Roth <troth@netmagic.net>)
(gtk_notebook_pages_allocate): don't map not visible tab_labels,
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
we use window->need_resize from configure_event now, to indicate that
the gtkwindow should keep its allocation (e.g. because the user resized
the window through window manager handles). resize_count is now reliably
used to figure whether we got the allocation we requested from the
window manager.
configure events get queued as resizes now, the real stuff (size
computation and allocation) now only goes on in gtk_window_move_resize().
GtkWindow's requisition now contains its *real* requisition (like all
other widgets), *not* taking usize into account.
geometry_info->last_{width|height} is now updated from set_hints() only
so it always contains the last hints we set for the window manager.
made some event handlers return TRUE instead of FALSE.
the overall code should be much more straight forward now, and the
significant code portions are accompanied by comments now.
(gtk_window_set_hints):
removed requisition argument and made it
fetch the requisition through gtk_widget_get_child_requisition.
we also don't move the gdkwindow here anymore, gtk_window_move_resize()
does that now.
(gtk_window_show):
ensure that the widget is realized before calling
gtk_container_check_resize() (and thus gtk_window_move_resize()), also
ensure that we got properly size requested and allocated before
realization.
(gtk_window_configure_event):
ignore plain window moves, or reallocate the widget tree through the
resize queue otherwise.
(gtk_window_move_resize):
mostly rewrote this function to figure window manager hints more
reliably, coalesce window moves and resizes to reduce configure events
and do actuall size allocations.
Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_event): discard expose events for widgets
that have a resize pending, because a redraw is already queued for them.
* gtk/gtkcontainer.c: removed ugly connect_to ::size_allocate signal
hack to clear resize_widgets.
* gtk/gtkwidget.c (gtk_widget_size_allocate): call clear_resize_widgets
for resize containers prior to size allocation. (this is also a bit
ugly, but avoids side effects for stopped emissions and is thus more
reliable).
(gtk_widget_unparent): removed disconnect call for clear_resize_widgets.
* gtk/gtktooltips.c (gtk_tooltips_paint_window): renamed this
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
checks.
(gtk_target_list_unref): Likewise.
* gtk/gtkthemes.c (gtk_theme_engine_unref): Likewise.
Tue Aug 17 15:47:07 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar):
guard against division by zero. (Fixes bug #1339)
Tue Aug 17 10:56:49 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_move_{forward,backward}_word):
Prevent the trivial leak of information of allowing
word motion when the entry is not visible.
Tue Aug 17 10:28:52 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_fileop_error): Propagate
modality to error dialog as well as confirmation dialogs.
(Bug #1803, reported by Rosanna Wing Sze Yuen)
Wed Aug 11 01:04:57 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreeitem.c (gtk_tree_item_draw_lines): Honor
tree->view_lines.
(gtk-guy-990611-3.patch: Guy Harris <guy@netapp.com>)
* gtk/Makefile.am (install-data-local): Solaris apparently
has various troubles with ln -f; use rm first instead.
(gtk-guy-990611-2.patch: Guy Harris <guy@netapp.com>)
1999-07-30 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (stamp-m): Don't `mv' from builddir to srcdir,
use `cp' followed by `rm' (the `rm' was already there).
July 30, 1999 Elliot Lee <sopwith@redhat.com>
* configure.in: Fix autoconf warnings about cross compilation by
trying to provide sane defaults for AC_TRY_RUN.
* gtk/Makefile.am: If we refer to gtkmarshal.[ch] in $(srcdir),
put them into $(srcdir) when generated. Also add a dependency of
gtksignal.h on gtkmarshal.h for -j builds.
* gtk/gtk(dnd,style,gamma).c: Minor warning fixes.
Wed Jul 28 09:29:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main_iteration_do): Added missing
GDK_THREADS_{LEAVE,ENTER} pair.
(From Paul Fisher <pnfisher@redhat.com>)
Fri Jul 23 01:00:15 1999 Tim Janik <timj@gtk.org>
* gtk/gtksocket.c (gtk_socket_size_request): asure that the requested
width and height are always >0 (owen).
Fri Jul 23 00:00:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): backed out my recent
change that assured that a widget's allocated with and height are
always >1, since this breaks *buggy* panel code. unfortunately this
back-breaks the gimp's color selector.
* gtk/gtkdrawingarea.c (gtk_drawing_area_size_allocate): asure that our
allocation is always >0 in width and height, before sending the
configure event; this is a *gross* hack to get the gimp back to work.
* marked both cases with TODO-1.3
Wed Jul 21 15:47:39 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Don't display wrap indicators when
text is not editable and word wrap is on.
Wed Jul 21 08:21:40 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case
option menus here as they are not derived from menu shell, assure that
the option menu has a menu we can add items to.
Tue Jul 20 23:29:48 1999 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation->
width/height to (gint) before calculations and check against < 0 to
avoid guint wraparounds.
Sun Jul 18 00:35:49 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated
width and height is never zero. sanity check both dimensions against
32767 and issue a warning if the allocation is greater than that.
Wed Jul 7 15:03:30 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_events_pending): Unlock around call
to g_main_pending() as well.
Wed Jul 7 14:59:01 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main_iteration): Unlock around
call to g_main_iteration() - since that will regrab
GTK+ lock to process events.
Thu Jul 1 15:01:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c
- Regularize with the rest of GTK+ by making widget->requisition
not reflect the set_usize()
- Always recompute geometry hints, then check if they
changed before sending them to the X server. The
previous checks for changes would fail in a number
of circumstances.
Thu Jul 1 11:55:59 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c: Include <stdlib.h> for strcmp().
Wed Jun 30 19:26:36 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c:
- Code cleanups
- Instantaneously update on modifier key presses
- Allow cancellation of the drag with Escape.
Tue Jun 29 17:04:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (create_handle_box): Set the policy
to auto_shrink - otherwise the appearance is rather
strange when flipping between horizontal and vertical.
Mon Jun 28 09:29:52 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c: add ::default_width and ::default_height arguments.
(gtk_window_set_default_size): don't change a value if it's < 0.
queue a resize.
Sun Jun 27 11:00:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (gtk_text_insert): don't segfault on NULL inserts.
Mon Jun 28 12:08:25 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Don't
add an extra "/" when concating "/" + filename.
(From Matt Grossman <mattg@oz.net>)
Mon Jun 28 10:57:12 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (draw_cell_pixmap): Reset clip mask
for fg_gc if we set it for drawing pixmap.
Tue Jun 15 12:45:12 1999 Owen Taylor <otaylor@redhat.com>
Fixes from Peter Wainwright <prw@wainpr.demon.co.uk>
* gtk/gtkrc.c (gtk_rc_parse_engine): If rc_style->engine is
already set, call old engine's destroy function and
unref the old engine.
Thu Jun 10 17:59:38 1999 Tim Janik <timj@gtk.org>
* gtk/gtkdrawingarea.c (gtk_drawing_area_size): queue a resize.
Wed Jun 9 15:13:16 1999 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h: mark certain functions as internal.
Wed Jun 9 13:48:28 1999 Tim Janik <timj@gtk.org>
* gtk/gtkpreview.c (gtk_preview_set_expand): queue a resize if the
expand behaviour changed.
* gtk/gtklabel.c (gtk_label_set_pattern):
(gtk_label_set_justify):
(gtk_label_set_line_wrap):
don't bother invoking queue_clear, the reallocation does
that for us, always free_words so the upcoming resize will
relayout the label's contents.
Wed Jun 9 12:50:48 1999 Tim Janik <timj@gtk.org>
* applied argument implementation patches from Elena Devdariani
<elena@cogent.ca>.
* gtk/gtktoolbar.c: ::orientation, ::toolbar_style, ::space_size,
::space_style, ::relief
* gtk/gtkruler.c: ::lower, ::upper, ::position, ::max_size
* gtk/gtkpreview.c: ::expand
* gtk/gtkpaned.c: ::handle_size, ::gutter_size
* gtk/gtknotebook.c: ::homogeneous
* gtk/gtklabel.c: ::wrap
* gtk/gtklist.c: ::selection_mode
* gtk/gtkhandlebox.c: ::handle_position, ::snap_edge
* gtk/gtkcurve.c: ::curve_type, ::min_x, ::max_x, ::min_y, ::max_y
* gtk/gtkcolorsel.c: ::update_policy, ::use_opacity
* gtk/gtkclist.c: ::sort_type
* gtk/gtkcheckmenuitem.c: ::active, ::show_toggle
* gtk/gtkaspectframe.c: ::xalign, ::yalign, ::ratio, ::obey_child
Tue Jun 1 23:38:38 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c: Removed ill-thought-out part of last
comment.
Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_attach): Get the reference
counting right when we have to attach a new style
for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>)
* gtk/gtkstyle.c: Documented the refcounting
peculularities of gtk_style_attach.
1999-06-01 Tim Janik <timj@dhcpd7.redhat.com>
* gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid
window types.
* examples/packer/pack.c (main): use GTK_WINDOW_TOPLEVEL instead
of GTK_TOPLEVEL for creating the window.
1999-06-01 Tim Janik <timj@dhcpd7.redhat.com>
* gtk/gtkmain.c (gtk_init_check): don't segfault when --gtk-module is
the last argument (reported by Per Winkvist).
Tue May 25 13:13:12 1999 Owen Taylor <otaylor@redhat.com>
Fixes for invisible XOR lines (Frank Loemker
<floemker@TechFak.Uni-Bielefeld.DE>)
* gtk/gtkclist.c (gtk_clist_realize): Always use
a non-zero pixel for GDK_XOR.
* gtk/gtkvpaned.c gtk/gtkhpaned.c:
Use GDK_INVERT instead of GDK_XOR.
Wed May 12 21:56:40 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (adjust_adjustments): signal emit value_changed
signals if h/voffsets differ from adjustment values.
Reportet by Jerome Bolliet <bolliet@in2p3.fr>
Mon May 10 04:20:41 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): propagate
::selection-done emissions up to the topmost menu shell.
Fri May 7 10:15:14 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_scrollable): Unset
the user data on the window before destroying it.
* gtk/gtknotebook.c (gtk_notebook_unrealize): Add an
unrealize handler to take care of destroying
notebook->panel properly.
(Bug #1198 - Morten Welinder <terra@diku.dk>)
* gtk/gtktext.c (expand_scratch_buffer): Fix reversal
of g_new and g_realloc to stop memory leak. (Actually,
we could just use g_realloc(), but I'm not 100% sure
that is portable).
(Bug #1196 - Morten Welinder <terra@diku.dk>)
Wed Apr 21 00:42:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkplug.h: Removed stray GtkPlugButton declaration.
* gdk/gdkfont.c (gdk_text_measure): Fix the return value
for fontsets.
* gtk/gtkbutton.c (gtkbutton_expose): Fix warning
with bin/button confusion.
Thu May 6 04:53:26 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: in the ItemFactory test, link radio items together,
and show how preselection of radio items is done.
Sun May 2 13:31:14 1999 Tim Janik <timj@gtk.org>
* gtk/gtktreeitem.c (gtk_tree_item_set_subtree):
* gtk/gtktree.c (gtk_tree_add) (gtk_tree_insert):
* gtk/gtktoolbar.c (gtk_toolbar_insert_element):
* gtk/gtkpaned.c (gtk_paned_pack2) (gtk_paned_pack1):
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add):
* gtk/gtktable.c (gtk_table_attach):
* gtk/gtklist.c (gtk_list_insert_items):
* gtk/gtkmenushell.c (gtk_menu_shell_insert):
* gtk/gtknotebook.c (gtk_notebook_insert_page_menu):
* gtk/gtkpacker.c (gtk_packer_add_defaults) (gtk_packer_add):
* gtk/gtkbin.c (gtk_bin_add):
* gtk/gtkbox.c (gtk_box_pack_start) (gtk_box_pack_end):
* gtk/gtkfixed.c (gtk_fixed_put):
* gtk/gtklayout.c (gtk_layout_put):
general fixups to container_add logic. always realize child if
child->parent is realized, only map the child and queue a resize
if child and child->parent are both visible.
Fri Apr 30 09:02:28 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): use gtk_container_forall
instead of gtk_container_foreach to walk and unrealize children, so
composite children get also unrealized.
(gtk_widget_real_show): don't call gtk_widget_map() if we don't need to.
(gtk_widget_map): assert that the widget is visible (basic constrain).
(gtk_widget_real_map): assert that the widget is realized (basic
constrain).
Fri Apr 29 00:53:20 1999 Tim Janik <timj@gtk.org>
* gtk/gtkbindings.c (gtk_pattern_spec_init): plugged a memory leak.
Tue May 4 09:32:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am gtk/gtkrc.iso-8859-2: Add a gtkrc
file for iso-8859-2 locales.
* configure.in (ALL_LINGUAS): ALL_LINGUAS update.
Tue Apr 27 16:38:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Fix typo of static_sources for static_SOURCES.
(Pointed out by andy@rz.uni-karlsruhe.de and others).
Remove some suspicious and useless lines.
Tue May 4 08:44:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c (gtk_clist_draw, draw_rows): Use
width,height = 0, 0 to mean - here to edge of window,
instead of -1, -1, since the former is all we support.
Tue May 4 08:34:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main): Correctly free list nodes
when removing from quit_functions list.
Tue Apr 27 14:17:16 1999 Tim Janik <timj@gtk.org>
* gtk/gtkpacker.c (gtk_packer_size_request): remove unused variable.
Tue Apr 27 18:23:35 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
When redrawing characters on non-visible entry, use appropriate
'*' character. (Bug #1130 - Jean-Marc Jacquet <jm@littleigloo.org>)
Tue Apr 27 01:31:40 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (drag_dest_cell): compute destination cell
from drag coordinates.
(gtk_clist_drag_data_received) (gtk_clist_drag_motion):
use drag_dest_cell.
* gtk/gtktree (drag_dest_cell)
(gtk_ctree_drag_data_received) (gtk_ctree_drag_motion): likewise.
(Bug #1129)
Wed Apr 21 21:26:11 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_init): properly initialize
translate_* fields.
(gtk_item_factory_finalize): invoke translate_notify independant from
translate_data.
(gtk_item_factory_set_translate_func): likewise.
(gtk_item_factory_destroy): only remove ifactory pointer from those
widgets that belong to us (stupid me).
Mon Apr 19 12:05:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_style_init): Fixed leak of
rc_style list when lookup succeeeds.
Thu Apr 15 01:11:24 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (resync_selection):
* gtk/gtkclist.c (resync_selection): fixed undo_selection bug.
* gtk/gtkclist.c (gtk_clist_button_release): fixed resync_selection
bug.
Fri Apr 9 19:22:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c gtk/gtkdnd.c gtk/gtkmenuitem.c:
Add some missing GDK_THREADS_ENTER()/LEAVE around
timeouts. (Patches from Sebastian Wilhelmi <wilhelmi@ira.uka.de>)
Thu Apr 8 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_key_press): use gtk_widget_activate()
rather than emit_by_name.
* gtk/gtkeditable.c (gtk_editable_insert_text): keep a reference
on the widget across multiple signal emissions.
(gtk_editable_delete_text): same here.
(gtk_editable_class_init): set widget_class->activate_signal after
editable_signals[ACTIVATE] has been created.
Wed Apr 7 22:59:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpaned.c (gtk_paned_set_position): Don't clamp
position here prematurely -- we might not have the
right ->min_position and ->max_position yet.
Tue Apr 6 16:38:51 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c gdk/gdkselection.c: (gtk_selection_request):
Add error traps so if the other end of the connection
dies, we survive.
* gtk/gtkselection.c (gtk_selection_notify): Clean
up properly when selection property retrieval fails.
* gtk/gtkselection.c (gtk_selection_request): Correctly
reject SelectionRequest notifies where the handler
returns no data.
Tue Apr 6 12:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (gtk_drag_dest_leave): Only unhighlight
when we've previously highlighted.
* gtk/gtkdnd.c (gtk_drag_dest_handle_event): Don't
emit two "drag_leave" signals for Motif drops.
* gtk/gtkdnd.c (gtk_drag_source_handle_event): Send
back the correct status messages when dropping from
Motif onto a proxy window that is rejecting the
drop.
Sat Mar 27 23:32:13 1999 Tim Janik <timj@gtk.org>
* gtk/gtkarg.[hc]: added functions from GLE, gtk_arg_reset() to free
the value and reset type to GTK_TYPE_INVALID, and gtk_arg_values_equal()
to compare two argument values. added gtk_arg_to_valueloc() to set a
variable from an arg through its location (pointer).
* gtk/gtkobject.[hc]: implemented gtk_object_get() in terms of
gtk_object_arg_get() and gtk_arg_to_valueloc(), floats are collected
as gfloat*, uchars are collected as guchar*, ints are collected as
gint*, etc...
Mon Mar 29 17:45:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccelgroup.c gtk/gtkgtkbindings.c:
Include <string.h> instead of <strings.h>.
* gtk/gtkstyle.c: Fix double include of gtkthemes.h
(actually, a lot more duplicate includes occur if
you trace through the sequence of #include's)
gtk-jbb-990320-0: John Bley, jbb6@acpub.duke.edu
Mon Mar 29 17:02:58 1999 Owen Taylor <otaylor@redhat.com>
Patches from Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>
gtk-a-higuti-990322-[0-3]
* configure.in: Fix confusion between GTK_LOCALE_[C]FLAGS
that was causing -DX_LOCALE not to work.
* gtk/gtkrc.c (gtk_rc_init):
X_LOCALE will never have LC_MESSAGES defined
Thu Mar 25 12:38:31 1999 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_append_default_module_path): get $HOME from
g_get_home_dir() (gtk-pmc-990123-0.patch.gz).
* gtk/gtkwindow.c (gtk_window_key_press_event): feature keypad up/down/
left/right as well (gtk-michael-980726-0.patch.gz).
* gtk/gtklabel.[hc]: bunch of miscellaneous cleanups, such as s/0/NULL/
for pointer values, use gchar instead of char. fixed uline allocation
leaks, changed the allocation pattern so we use G_ALLOC_AND_FREE mem
chunks instead of G_ALLOC_ONLY.
(gtk_label_size_request): always alter requisition as passed and leave
widget->requisition alone.
(gtk_label_set_text): allow NULL strings.
(gtk_label_new): likewise.
Wed Mar 24 09:24:03 1999 Tim Janik <timj@gtk.org>
* gtk/gtkdrawingarea.[hc]: type/macro fixups.
Mon Mar 22 05:51:34 1999 Tim Janik <timj@gtk.org>
* gtk/gtkbin.c (gtk_bin_draw): only redraw children that are visible
*and* mapped (i.e. drawable).
(gtk_bin_expose): only send exposes to drawable children.
* gtk/gtkbox.c (gtk_box_draw): only redraw children that are drawable.
(gtk_box_expose): only send exposes to drawable children.
* gtk/gtkhscale.c (gtk_hscale_draw):
* gtk/gtkvscale.c (gtk_vscale_draw):
hm, this is an ugly one. we first compute the size of our trough area
here (window relative) and then check intersection with the draw_area
which is parent relative because we're a NO_WINDOW widget, so we need
to offset the trough area by allocation.x and allocation.y before the
check. (this must not be done for the background area though, since
that's already computed parent relative).
Mon Mar 22 00:41:39 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_unrealize): unmap clist if neccessary,
unrealize title buttons.
Fri Mar 19 00:00:22 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_column_title_passive)
(gtk_clist_column_title_active):
only connect/disconnect to GtkWidgetClass::event to block mouse events.
* gtk/gtkclist.c (vertical_timeout) (horizontal_timeout):
zero initialize event, removed superfluous gdk_window_get_pointer call
* gtk/gtklist.c (gtk_list_vertical_timeout)
(gtk_list_horizontal_timeout): removed superfluous
gdk_window_get_pointer call
Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org>
* plugging problems reported by "Bruce Mitchener, Jr."
<bruce@puremagic.com> due to a purify session.
* gtk/gtkstyle.c:
(gtk_style_ref):
(gtk_style_unref): assert ref_count to be > 0.
* gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize
the requisition.
(gtk_clist_set_shift): likewise.
* gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the
adjustments.
* gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the
event before sending it and set send_event to TRUE (which needs to
be done for *all* synthesized events).
(gtk_list_vertical_timeout): likewise.
* gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory
leaks.
* gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event
to TRUE when synthesizing events.
[ *** end of merges from 1.2 *** ]
1999-11-22 21:52:50 +00:00
|
|
|
gtk_file_selection_fileop_error (fs, buf);
|
1998-01-21 07:53:07 +00:00
|
|
|
}
|
2001-03-12 15:39:19 +00:00
|
|
|
|
|
|
|
out:
|
1998-01-21 07:53:07 +00:00
|
|
|
g_free (full_path);
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_full_path);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
gtk_widget_destroy (fs->fileop_dialog);
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (fs, "", FALSE, FALSE);
|
1998-01-21 07:53:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_file_selection_create_dir (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
|
|
|
GtkFileSelection *fs = data;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
|
|
|
|
|
|
if (fs->fileop_dialog)
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
return;
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
/* main dialog */
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
dialog = gtk_dialog_new ();
|
|
|
|
fs->fileop_dialog = dialog;
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (dialog, "destroy",
|
|
|
|
G_CALLBACK (gtk_file_selection_fileop_destroy),
|
|
|
|
fs);
|
2002-02-01 17:41:47 +00:00
|
|
|
gtk_window_set_title (GTK_WINDOW (dialog), _("New Folder"));
|
1998-11-28 07:42:37 +00:00
|
|
|
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fs));
|
1998-08-11 19:06:18 +00:00
|
|
|
|
|
|
|
/* If file dialog is grabbed, grab option dialog */
|
|
|
|
/* When option dialog is closed, file dialog will be grabbed again */
|
2000-08-12 07:25:55 +00:00
|
|
|
if (GTK_WINDOW (fs)->modal)
|
|
|
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
1998-08-11 19:06:18 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox,
|
1998-01-21 07:53:07 +00:00
|
|
|
FALSE, FALSE, 0);
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_widget_show( vbox);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2002-02-01 17:41:47 +00:00
|
|
|
label = gtk_label_new_with_mnemonic (_("_Folder name:"));
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_misc_set_alignment(GTK_MISC (label), 0.0, 0.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 5);
|
|
|
|
gtk_widget_show (label);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
/* The directory entry widget */
|
|
|
|
fs->fileop_entry = gtk_entry_new ();
|
2001-03-24 06:10:40 +00:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), fs->fileop_entry);
|
1998-01-21 07:53:07 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), fs->fileop_entry,
|
|
|
|
TRUE, TRUE, 5);
|
2000-08-12 07:25:55 +00:00
|
|
|
GTK_WIDGET_SET_FLAGS (fs->fileop_entry, GTK_CAN_DEFAULT);
|
2003-05-21 22:54:53 +00:00
|
|
|
gtk_entry_set_activates_default (GTK_ENTRY (fs->fileop_entry), TRUE);
|
1998-01-21 07:53:07 +00:00
|
|
|
gtk_widget_show (fs->fileop_entry);
|
|
|
|
|
|
|
|
/* buttons */
|
2003-05-21 22:54:53 +00:00
|
|
|
button = gtk_dialog_add_button (GTK_DIALOG (dialog),
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect_swapped (button, "clicked",
|
|
|
|
G_CALLBACK (gtk_widget_destroy),
|
|
|
|
dialog);
|
1998-08-11 19:06:18 +00:00
|
|
|
|
2001-10-29 18:44:15 +00:00
|
|
|
gtk_widget_grab_focus (fs->fileop_entry);
|
|
|
|
|
2003-05-21 22:54:53 +00:00
|
|
|
button = gtk_dialog_add_button (GTK_DIALOG (dialog),
|
|
|
|
_("C_reate"), GTK_RESPONSE_OK);
|
2002-10-25 19:57:48 +00:00
|
|
|
gtk_widget_set_sensitive (button, FALSE);
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (button, "clicked",
|
|
|
|
G_CALLBACK (gtk_file_selection_create_dir_confirmed),
|
|
|
|
fs);
|
2002-10-25 19:57:48 +00:00
|
|
|
g_signal_connect (fs->fileop_entry, "changed",
|
|
|
|
G_CALLBACK (gtk_file_selection_fileop_entry_changed),
|
|
|
|
button);
|
|
|
|
|
2003-05-21 22:54:53 +00:00
|
|
|
gtk_widget_grab_default (button);
|
2001-11-02 20:02:44 +00:00
|
|
|
|
1998-08-11 19:06:18 +00:00
|
|
|
gtk_widget_show (dialog);
|
1998-01-21 07:53:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-02-11 21:17:11 +00:00
|
|
|
gtk_file_selection_delete_file_response (GtkDialog *dialog,
|
|
|
|
gint response_id,
|
|
|
|
gpointer data)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
|
|
|
GtkFileSelection *fs = data;
|
|
|
|
CompletionState *cmpl_state;
|
|
|
|
gchar *path;
|
|
|
|
gchar *full_path;
|
2000-08-12 07:37:27 +00:00
|
|
|
gchar *sys_full_path;
|
2001-03-12 15:39:19 +00:00
|
|
|
GError *error = NULL;
|
1998-01-21 07:53:07 +00:00
|
|
|
gchar *buf;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
|
|
|
2002-02-11 21:17:11 +00:00
|
|
|
if (response_id != GTK_RESPONSE_OK)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (GTK_WIDGET (dialog));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
cmpl_state = (CompletionState*) fs->cmpl_state;
|
|
|
|
path = cmpl_reference_position (cmpl_state);
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
full_path = g_strconcat (path, G_DIR_SEPARATOR_S, fs->fileop_file, NULL);
|
2001-03-12 15:39:19 +00:00
|
|
|
sys_full_path = g_filename_from_utf8 (full_path, -1, NULL, NULL, &error);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
if (g_error_matches (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
|
|
|
|
buf = g_strdup_printf (_("The filename \"%s\" contains symbols that are not allowed in filenames"),
|
|
|
|
fs->fileop_file);
|
|
|
|
else
|
|
|
|
buf = g_strdup_printf (_("Error deleting file \"%s\": %s\n%s"),
|
|
|
|
fs->fileop_file, error->message,
|
|
|
|
_("It probably contains symbols not allowed in filenames."));
|
|
|
|
|
|
|
|
gtk_file_selection_fileop_error (fs, buf);
|
|
|
|
g_error_free (error);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2004-12-12 21:09:13 +00:00
|
|
|
if (g_unlink (sys_full_path) < 0)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
2001-03-12 15:39:19 +00:00
|
|
|
buf = g_strdup_printf (_("Error deleting file \"%s\": %s"),
|
|
|
|
fs->fileop_file, g_strerror (errno));
|
Adapt cast macros to standard.
Fri Nov 19 10:34:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkgamma.h: Adapt cast macros to standard.
[ Merges from 1.2 ]
Tue Nov 16 10:15:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_path):
If translation does not include a '/', use entire
translation instead of crashing.
Sun Oct 31 22:21:11 1999 Tim Janik <timj@gtk.org>
* docs/gtk_tut.sgml:
s/gtk_accel_group_attach/gtk_window_add_accel_group/.
Sat Oct 30 09:09:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_remove): Use
g_list_remove_link, not g_list_remove.
[ From Geert Bevin <gbevin@thunderstorms.org> ]
Sun Oct 24 07:41:40 1999 Tim Janik <timj@gtk.org>
* gtk/gtkclist.c (real_undo_selection): commented out g_print()
statement upon unselection (how the heck did that slip in?).
Sat Oct 23 03:03:08 1999 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (gtk_text_freeze):
(gtk_text_thaw): undraw/draw cursor here to avoid unnecessary scrolling
in frozen state (and aparently crashes). patch provided by Anders
Melchiorsen <and@kampsax.dtu.dk>.
Sat Oct 23 02:53:20 1999 Tim Janik <timj@gtk.org>
* fix insensitive default/focus widget activation,
reported by Matt Goodall <mgg@isotek.co.uk>.
* gtk/gtkwindow.c (gtk_window_key_press_event):
(gtk_window_activate_default):
(gtk_window_activate_focus):
return handled=FALSE for actiavtion of insensitive default
widgets. return handled=TRUE for activation of insensitive
focus widgets. don't activate in either case.
Tue Oct 19 09:55:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk-config.in (lib_gtk): Switch order of @x_cflags@
and $glib_cflags to match library order and in the
theory that an old version of GLib is more likely to
be in the include directory for X then vice-versa.
(Bug #2776)
Tue Oct 19 09:46:49 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Always use LC_CTYPE
to determine the locale for fontsets, not LC_MESSAGES;
the user may want English messages with a handling
for non-English languages. (LC_CTYPE=ru_RU LC_MESSAGES=fr_FR
will still be broken) (Bug #2891)
Tue Oct 19 20:36:42 1999 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
* gtk/gtkrc.ko: Fixed the wrong number of "*"'s.
Tue Oct 19 12:15:13 1999 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
* gtk/gtkrc.ko: Changed the Korean default fontset.
Fri Oct 8 02:32:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): Fix bug
where when scrolling to the left or top double exposes
were done, causing major slowdowns.
Thu Oct 7 18:31:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Always normalize codeset
names to lowercase and alphanumeric, before looking
them up.
* gtk/Makefile.am: Install codeset variant gtkrc files
with normalized names.
Thu Oct 7 22:52:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_popup_with_data): even
popup menus when the menu is already visible, but its parent
is still hidden, (happens after tornoff window got hidden).
Thu Oct 7 11:09:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (install-data-local): Fix
a typo where gtkrc.vi_VN.tcvn5712 wasn't getting
deleted, causing error messages on install.
Thu Oct 7 11:03:06 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtk[hv]paned.c (gtk_{h,v}paned_draw): Redraw
the handle as well, since we now sometimes ignore
exposes on the handle while resizing.
Wed Oct 6 18:02:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_append_default_pixmap_path): Fix stupid
extra g_free introduced in one of the last one or two
commits.
Wed Oct 6 16:38:36 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am gtk/gtkrc*: Make naming of gtkrc files
consistent, put each style that a gtkrc.* file creates
in a unique namespace, remove old files before installing.
Wed Oct 6 14:31:16 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Avoid leaking memory when
gtk_rc_init is called multiple times. (Yes, people who
do that have bugs in their code.)
Tue Oct 5 11:36:57 PDT 1999 Manish Singh <yosh@gimp.org>
* gtk/Makefile.am: listing gtkrc in gtkconf_DATA seems to barf.
Remove it since it's generated by the Makefile anyway
Tue Oct 5 02:43:41 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkinputcommon.h (gdk_input_device_new): Free
device->info.axes for core pointer.
Thu Sep 30 13:55:25 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (destroy_idle_test): Rename idle to
idle_id, to deal with obsolete, broken C libraries.
Mon Sep 27 02:50:15 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkvscale.c (gtk_vscale_draw): Don't add in
allocation->x/y twice!
* gtk/gtkhscale.c: Make usage of gtk_hscale_pos_trough()
consistent with gtk_vscale_pos_trough().
Sun Sep 26 19:44:34 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcontainer.c (gtk_container_queue_resize): We may
be queueing a resize on a toplevel container between
the time we show it and when we map it. So, we need
to test GTK_WIDGET_VISIBLE() for toplevels, and only
use GTK_WIDGET_DRAWABLE() for child windows.
Thu Sep 23 16:41:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDADDS): Add GDK_WLIBS to LDADDS
(fixes bug #2144)
Fri Sep 24 00:51:45 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_queue_resize): check for
container DRAWABLE (instead of VISIBLE), so we don't queue
resizes on non-toplevel containers.
Sun Sep 19 18:13:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.[ch]: Make the data argument
const guchar *.
Sat Sep 18 21:27:40 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c: Try to behave sensibly if
the focus widget is the window itself. (Should
we allow this at all?)
Fri Sep 17 09:57:15 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_set_sensitive):
* gtk/gtknotebook.c (gtk_notebook_set_scrollable):
* gtk/gtknotebook.c (gtk_notebook_set_show_border):
* gtk/gtkclist.c (gtk_notebook_set_show_border): make gboolean args
in prototypes and implementations consistent (Tomas Ogren).
* gtk/gtklayout.c (gtk_layout_remove): unset GTK_IS_OFFSCREEN flag
before the widget is unparented (reported by damon).
* gtk/gtkdnd.c: make the cursor and icon data _unsigned_ char,
since we provide unsigned data anyways.
Thu Sep 16 21:32:01 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c (gtk_tooltips_set_tip): Delay
the call to gtk_tooltips_layout_text() until later.
* gtk/gtktooltips.c (gtk_tooltips_draw_tips):
Call gtk_widget_ensure_style() before using the style.
Wed Sep 15 02:52:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_event): Added workaround
for old widgets that don't propagate draws to all
children. (Namely gnome-dock for gnome-libs <= 1.0.16)
Tue Sep 14 19:22:19 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): don't queue the parent
for a redraw but just the widget that requested the resize.
Tue Sep 14 18:29:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: added new widget level method
gtk_container_set_reallocate_redraws() and a GtkContainer flag
reallocate_redraws : 1 to reflect the setting, exported this through
the argument system as a boolean ::reallocate_redraws.
* gtk/gtkwidget.c (gtk_widget_size_allocate): when queueing redraws
on the widget because the allocation changes, do so as well for
widget->parent if the parent has reallocate_redraws set to TRUE.
with that containers requesting reallocation redraws get automatically
redrawn if their children changed allocation (this unfortunately
affects also other children that didn't change allocation, but we
cannot work around that before 1.3).
Tue Sep 14 18:23:01 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_idle_draw): only emit ::draw if width
_and_ height are >0 (not _or_).
* gtk/gtktable.c (gtk_table_remove): use gtk_widget_queue_resize()
instead of gtk_container_queue_resize(), which is a core gtk internal
function (must have been on crack when i queued that).
* gtk/gtkprivate.h: added new private flag GTK_FULLDRAW_PENDING, so
we can check more reliably if we want to discard expose events.
* gtk/gtkwidget.c: added setting/unsetting of the GTK_FULLDRAW_PENDING
flag.
* gtk/gtkwidget.c (gtk_widget_event): don't discard synthesized exposes,
we simply trust these events. for deciding whether to discard exposes,
check GTK_FULLDRAW_PENDING instead of RESIZE_PENDING.
Mon Sep 13 15:01:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_queue_clear_area): Ignore
queues of areas that are completely off screen.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Fix broken
logic for handleboxes.
* gtk/gtkwidget.c (gtk_widget_queue_draw_data): Add santity
check on width/height.
Mon Sep 13 02:22:47 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am: backed out Raja's recent VPATH build "improvements",
we are fine with using $@ the way we do (if we actually encounter
brokeness with $@ in VPATH builds because of additional path prefixes,
we need to use $(@F) actually).
Mon Sep 13 01:34:53 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: renamed two variables, hopefully didn't introduce
short lived bugs, that would allow language bindings to do surgeries
to our guts.
Fri Sep 10 15:22:50 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_size_allocate): Fix typo
where comparison was being done against an uninitialized
value causing intermittant results depending on
compiler flags. Also make it clearer that we aren't
ever initializing the child as 0x0 (though this will
be caught in gtk_widget_size_allocate())
Fri Sep 10 10:06:56 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_set_transient_for): Move
gtk_window_unset_transient_for() call after we do checks
involving the old transient parent.
[ From Lance Capser <lmc@cyberhighway.net> ]
1999-09-07 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (gtk.defs): Go back to using `touch' to create
an empty file.
Mon Sep 6 00:11:56 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_is_ancestor): return FALSE if node has
no children. (Reported by: Chris Rogers <gandalf@pobox.com>)
1999-09-03 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (gen_sources): Improve VPATH builds.
`$@' is valid only in the build dir, not after we've done
`cd $srcdir'. Also use `test -f' instead of less portable
`test -e'.
Fri Sep 3 15:59:56 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (correct_cache_insert): Rewrite
for simplicity, and hopefully correctness.
(Fixes bug #1322, which was a segfault when
on some insertions with the properties around
the insertion set up just wrong.)
* gtk/gtktext.c (gtk_text_adjustment): When we receive
a "changed" signal, clamp the new value to the adjustment
bounds to avoid segfaulting if someone tries to change
the adjustment to a bogus value. (Bug #1795)
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness
problem that was causing background to sometimes
be misaligned.
Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
[ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
* gtk/gtkmenu.c (gtk_menu_position): Make
sure we never position menus with negative x, y,
since gtk_widget_set_uposition() can't handle that.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
Modify the positioning code a bit so that we always
put the top-left corner onscreen. (This is for
UI reasons, gtk_menu_position() now takes care of
gtk_widet_set_uposition() brokeness.)
Fri Sep 3 03:06:30 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am: fixed up things for -jx, x > 1.
Sun Sep 5 08:48:51 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_style): Ref the
RC style that is passed in. The lack of the ref
before was a bug. If people worked around this
bug, this will introduce a slight memory leak
in their code. The code should typically look like:
rc_style = gtk_rc_style_new ();
[...]
gtk_widget_modify_style (widget, rc_style);
gtk_rc_style_unref (rc_style);
* gtk/gtkwidget.c (gtk_widget_modify_style): Reset
the style if it was already set.
* gtk/gtkwidget.c (gtk_widget_set_name): Only set the
style if it was set before.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (main): Add a check to see if we
are being run from the correct directory and
to quit nicely if we are not.
* gtk/gtkrc.c (gtk_rc_slist_remove_all): Make function
static.
Thu Sep 2 23:00:03 1999 Tim Janik <timj@gtk.org>
* gtk/gtkenums.h (GtkWindowPosition): added GTK_WIN_POS_CENTER_ALWAYS.
* gtk/gtkwindow.c:
queue resizes unconditionally (gtk_widget_queue_resize will figure
what to do if the window is not realized).
(gtk_window_move_resize): only recenter the window
for GTK_WIN_POS_CENTER_ALWAYS.
(gtk_window_compute_reposition): handle GTK_WIN_POS_CENTER_ALWAYS in
the same way as GTK_WIN_POS_CENTER.
Thu Sep 2 22:39:27 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_reposition): check for the last position
with (!(info->last_flags & GDK_HINT_POS)) instead of
(!info->last_flags & GDK_HINT_POS).
* gtk/gtkwindow.c (gtk_window_move_resize): constrain new_width and
new_height unconditionally, because we use these values even if
!default_size_changed && !hints_changed.
comented the (default_size_changed || hints_changed) case with
respect to resize rejects from the window manager.
* gtk/gtkwindow.c (gtk_window_move_resize): save info->last values
in the zvt condition hack, since this includes the window hints, set
the hints after the handling_resize case.
* gtk/gtkwindow.c (gtk_window_show): constrain the default size that a
window is initially shown with to the geometry.
Thu Sep 2 07:38:56 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize):
s/size_changed/default_size_changed/g so i know what's
really going on (frying brain on smaller flame now).
Thu Sep 2 05:47:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize): queue a new resize if
we have size_changed upon handling_resize. this is a gross
workaround for the broken zvt widget and should be removed in
1.3 again (search for FIXME).
Owen provided an accurate comment for this:
/* We could be here for two reasons
* 1) We coincidentally got a resize while handling
* another resize.
* 2) Our computation of size_changed was completely
* screwed up, probably because one of our children
* is broken. It's probably a zvt widget.
*
* For 1), we could just go ahead and ask for the
* new size right now, but doing that for 2)
* might well be fighting the user (and can even
* trigger a loop). Since we really don't want to
* do that, we requeue a resize in hopes that
* by the time it gets handled, the child has seen
* the light and is willing to go along with the
* new size. (this happens for the zvt widget, since
* the size_allocate() above will have stored the
* requisition corresponding to the new size in the
* zvt widget)
*
* This doesn't buy us anything for 1), but it shouldn't
* hurt us too badly, since it is what would have
* happened if we had gotten the configure event before
* the new size had been set.
*/
Wed Sep 1 20:46:11 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: deal properly with the fact that RC
style lists may include rc styles more than once.
* gtk/gtkrc.c (gtk_rc_append_pixmap_path): Removed
unused static function.
* gtk/gtkrc.c (gtk_rc_find_pixmap_in_path): Keep a
stack of directories of RC files currently being
parsed and implicitely add them to pixmap path.
This fixes a bug where the directory would get
appended then overwritten by pixmap_path declarations.
(bug #1462, from Peter Wainright <prw@wainpr.demon.co.uk>)
* gtk/gtkthemes.c (gtk_theme_engine_unref): Call
theme's exit function. (Patch from Peter Wainwright,
bug #1454)
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_destroy):
Add a destroy() handler to take care of removing
group for menu item. (Fixes bug #1197)
* gtk/gtkwidget.c (gtk_widget_size_request): Fixed thinko
in warning message.
Wed Sep 1 21:27:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize): don't require a server
roundtrip to figure window's width and height, since we know that
anyways from widget->allocation.
Wed Sep 1 12:37:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Compute
the hints after we request the new size.
Wed Sep 1 10:38:37 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_compute_hints): Removed
GTK_WIDGET_REALIZED() assertion - we can compute the
hints before we are realized.
* gtk/gtkwindow.c (gtk_window_move_resize): Reorder
hint changing so that we have a value of hints_changed
when we decide whether to constrain the window size.
* gtk/gtkwindow.c (gtk_window_move_resize): Spelling fix.
* gtk/gtkwindow.c (gtk_window_constrain_size): cleanups,
change back to G_MAXINT.
Wed Sep 1 06:54:59 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_get_geometry_info): zero initialize
new GtkWindowGeometryInfo, so fields like GdkGeometry geometry
contain uncluttered values.
(gtk_window_compute_hints): simply assert that window is realized
and that geometry_info is valid, since we rely on this anyways.
(gtk_window_constrain_size): major cleanups to the code.
if (flags & GDK_HINT_BASE_SIZE) use geometry's base width and height
for the base size, instead of the minimums. use 32767 as max width
and height (like in gtkwindow.c) instead of G_MAXINT.
Wed Sep 1 04:41:25 1999 Tim Janik <timj@gtk.org>
* cleaned up the GtkContainer.need_resize flag handling mess, we
only need to force resize requests when we were prematurely
realized, or our widget tree was modified when we were temporarily
hidden. handling these cases directly upon showing the window (i.e.
while the GdkWindow is still unmapped) avoids the need to wait for
a configure event response and therefore makes the GUI more snappier
and avoids blank windows during the roundtrip.
* gtk/gtkwidget.c:
(gtk_widget_hide):
(gtk_widget_show): don't queue resizes on toplevels, they know how
to deal with matters.
* gtk/gtkcontainer.c (gtk_container_queue_resize): set the ->need_resize
flag directly for not visible resize containers and spare us unecessary
signal emissions.
* gtk/gtkwindow.c:
(gtk_window_realize): if we need to enforce premature size allocation,
queue a container resize so we are correctly resized later on.
(gtk_window_init):
(gtk_window_size_request):
don't freak around with the ->need_resize flag,
gtk_container_queue_resize() will care about that.
(gtk_window_show):
handle initial resizing issues here, we can handle matters better in
this place, especially since we know that our GdkWindow is still
unmapped.
(gtk_window_move_resize):
don't care about ->need_resize at all.
handle size changes properly that occoured while we waited for a
configure event.
Tue Aug 31 15:58:46 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_uposition):
* gtk/gtkwindow.[hc] (gtk_window_reposition):
Move the hint setting code from gtk_widget_set_uposition
to here; set the hints so that we respect any previously
set geometry hints.
* gtk/gtkwindow.c (gtk_window_compute_reposition): Don't
change the window hints here or move the window here,
let that happen in gtk_window_move_resize().
Tue Aug 31 06:58:52 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_event): when discarding exposes due
to already queued resizes (and therefore redraws) on a widget, check
its anchestry as well.
* gtk/gtkcontainer.c:
(gtk_container_queue_resize): clear resize widgets for resize
containers before aborting prematurely. this is especially important
for toplevels which may need imemdiate processing or their resize
handler to be queued.
(gtk_container_dequeue_resize_handler): added new internal function for
gtkwindow.c.
* gtk/gtkwindow.c (gtk_window_move_resize): if we are resizing due to a
configure event, take possible changes in window position into account
as well.
if we request a new window size, queue up a resize handler that will
last until the configure event response arrives.
combined the ->need_resize case (initial show) with the general size
(hints) changed case and added even more comments.
if !auto_shrink, only revert to the old allocation if the new size
is smaller than the current allocation.
Tue Aug 31 11:55:20 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_set_arg, gtk_window_set_policy,
gtk_window_set_geometry_hints
gtk_window_set_default_size):
When hints are set, queue a resize so that the hints will
be eventually reset on the toplevel.
* gtk/gtkwindow.c (gtk_window_show): Use
gtk_window_compute_default_size(). Clear the need_resize flag
on the initail map so that we don't unnecessarily trigger the
resize code.
* gtk/gtkwindow.c (gtk_window_move_resize): Split apart
into separate functions. Compare the hints we are setting
with what we set last time so that we can accurately
tell when we need to reset the hints.
* gtk/gtkwindow.c (gtk_window_compute_default_size): New
function to figure out the size from requisition
and default_size.
* gtk/gtkwindow.c (gtk_window_constrain_size): Function
from fvwm to constrain a size to the geometry hints.
* gtk/gtkwindow.c (gtk_window_compare_hints): New function
to compare two sets of geometry hints.
* gtk/gtkwindow.c (gtk_window_compute_hints): Renamed
from gtk_window_set_hints(), just compute the hints,
don't set them.
* gtk/gtkwindow.c (gtk_window_compute_reposition): Move
code from gtk_window_move_resize() to separate function,
rationalize a bit.
Tue Aug 31 13:05:03 1999 Owen Taylor <otaylor@redhat.com>
* gtkrc.h: Move the ref_count member out of the GtkRcStyle
structure into a new private structure.
* gtkrc.c: Split GtkRcStyle into public/private.
In the private part, add a list of pointers to the
RcStyle lists this RcStyle participates in.
* gtkrc.c: When a RcStyle is free, remove all
lists referencing it from the
realized_style_ht hash, and free those lists.
* gtk/gtkrc.c (gtk_rc_clear_styles): Don't call
gtk_rc_init(), since that adds the default styles
to the list of parsed RC files again.
* gtk/gtkrc.c: Use gtk_rc_style_find() consistently.
Thu Aug 26 14:14:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): reactivated the sanity
checks that ensure that a widget's allocation is at least 1 in width
and height. (GNOME note: this doesn't affect old panel code anymore,
because GtkSocket will request width and height of at least 1 since
Fri Jul 23).
* gtk/gtkwindow.c (gtk_window_realize): if the widget hasn't been
allocated yet (happens if the user realizes the window prematurely),
size request and allocate it.
(gtk_window_size_allocate): guard against guint underflows.
Wed Aug 25 19:01:36 1999 Lars Hamann <lars@gtk.org>
* gtk/Makefile.am (gtk_built_sources): reordered stamp-gtk.defs
in gtk_built_sources, so gtk.defs gets built prior to all other
sources.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am:
invoke indent on gtkmarshal.*.
rewrote source generation rules, use COPYING as oldest source tag for
a piggyback rule to generate all sources from (don't touch it ;).
major cleanups, strip spaces on build rules for GNU Make.
* gtk/genmarshal.pl: don't operate on hardcoded filenames but take
source and target files from commandline arguments. don't invoke indent.
Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_real_switch_page): queue_resize
notebook after switch to avoid drawing problems.
(Bug#856 Reported by: Theodore Roth <troth@netmagic.net>)
(gtk_notebook_pages_allocate): don't map not visible tab_labels,
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_real_switch_page): queue_resize
notebook after switch to avoid drawing problems.
(Bug#856 Reported by: Theodore Roth <troth@netmagic.net>)
(gtk_notebook_pages_allocate): don't map not visible tab_labels,
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
we use window->need_resize from configure_event now, to indicate that
the gtkwindow should keep its allocation (e.g. because the user resized
the window through window manager handles). resize_count is now reliably
used to figure whether we got the allocation we requested from the
window manager.
configure events get queued as resizes now, the real stuff (size
computation and allocation) now only goes on in gtk_window_move_resize().
GtkWindow's requisition now contains its *real* requisition (like all
other widgets), *not* taking usize into account.
geometry_info->last_{width|height} is now updated from set_hints() only
so it always contains the last hints we set for the window manager.
made some event handlers return TRUE instead of FALSE.
the overall code should be much more straight forward now, and the
significant code portions are accompanied by comments now.
(gtk_window_set_hints):
removed requisition argument and made it
fetch the requisition through gtk_widget_get_child_requisition.
we also don't move the gdkwindow here anymore, gtk_window_move_resize()
does that now.
(gtk_window_show):
ensure that the widget is realized before calling
gtk_container_check_resize() (and thus gtk_window_move_resize()), also
ensure that we got properly size requested and allocated before
realization.
(gtk_window_configure_event):
ignore plain window moves, or reallocate the widget tree through the
resize queue otherwise.
(gtk_window_move_resize):
mostly rewrote this function to figure window manager hints more
reliably, coalesce window moves and resizes to reduce configure events
and do actuall size allocations.
Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_event): discard expose events for widgets
that have a resize pending, because a redraw is already queued for them.
* gtk/gtkcontainer.c: removed ugly connect_to ::size_allocate signal
hack to clear resize_widgets.
* gtk/gtkwidget.c (gtk_widget_size_allocate): call clear_resize_widgets
for resize containers prior to size allocation. (this is also a bit
ugly, but avoids side effects for stopped emissions and is thus more
reliable).
(gtk_widget_unparent): removed disconnect call for clear_resize_widgets.
* gtk/gtktooltips.c (gtk_tooltips_paint_window): renamed this
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
checks.
(gtk_target_list_unref): Likewise.
* gtk/gtkthemes.c (gtk_theme_engine_unref): Likewise.
Tue Aug 17 15:47:07 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar):
guard against division by zero. (Fixes bug #1339)
Tue Aug 17 10:56:49 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_move_{forward,backward}_word):
Prevent the trivial leak of information of allowing
word motion when the entry is not visible.
Tue Aug 17 10:28:52 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_fileop_error): Propagate
modality to error dialog as well as confirmation dialogs.
(Bug #1803, reported by Rosanna Wing Sze Yuen)
Wed Aug 11 01:04:57 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreeitem.c (gtk_tree_item_draw_lines): Honor
tree->view_lines.
(gtk-guy-990611-3.patch: Guy Harris <guy@netapp.com>)
* gtk/Makefile.am (install-data-local): Solaris apparently
has various troubles with ln -f; use rm first instead.
(gtk-guy-990611-2.patch: Guy Harris <guy@netapp.com>)
1999-07-30 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (stamp-m): Don't `mv' from builddir to srcdir,
use `cp' followed by `rm' (the `rm' was already there).
July 30, 1999 Elliot Lee <sopwith@redhat.com>
* configure.in: Fix autoconf warnings about cross compilation by
trying to provide sane defaults for AC_TRY_RUN.
* gtk/Makefile.am: If we refer to gtkmarshal.[ch] in $(srcdir),
put them into $(srcdir) when generated. Also add a dependency of
gtksignal.h on gtkmarshal.h for -j builds.
* gtk/gtk(dnd,style,gamma).c: Minor warning fixes.
Wed Jul 28 09:29:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main_iteration_do): Added missing
GDK_THREADS_{LEAVE,ENTER} pair.
(From Paul Fisher <pnfisher@redhat.com>)
Fri Jul 23 01:00:15 1999 Tim Janik <timj@gtk.org>
* gtk/gtksocket.c (gtk_socket_size_request): asure that the requested
width and height are always >0 (owen).
Fri Jul 23 00:00:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): backed out my recent
change that assured that a widget's allocated with and height are
always >1, since this breaks *buggy* panel code. unfortunately this
back-breaks the gimp's color selector.
* gtk/gtkdrawingarea.c (gtk_drawing_area_size_allocate): asure that our
allocation is always >0 in width and height, before sending the
configure event; this is a *gross* hack to get the gimp back to work.
* marked both cases with TODO-1.3
Wed Jul 21 15:47:39 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Don't display wrap indicators when
text is not editable and word wrap is on.
Wed Jul 21 08:21:40 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case
option menus here as they are not derived from menu shell, assure that
the option menu has a menu we can add items to.
Tue Jul 20 23:29:48 1999 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation->
width/height to (gint) before calculations and check against < 0 to
avoid guint wraparounds.
Sun Jul 18 00:35:49 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated
width and height is never zero. sanity check both dimensions against
32767 and issue a warning if the allocation is greater than that.
Wed Jul 7 15:03:30 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_events_pending): Unlock around call
to g_main_pending() as well.
Wed Jul 7 14:59:01 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main_iteration): Unlock around
call to g_main_iteration() - since that will regrab
GTK+ lock to process events.
Thu Jul 1 15:01:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c
- Regularize with the rest of GTK+ by making widget->requisition
not reflect the set_usize()
- Always recompute geometry hints, then check if they
changed before sending them to the X server. The
previous checks for changes would fail in a number
of circumstances.
Thu Jul 1 11:55:59 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c: Include <stdlib.h> for strcmp().
Wed Jun 30 19:26:36 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c:
- Code cleanups
- Instantaneously update on modifier key presses
- Allow cancellation of the drag with Escape.
Tue Jun 29 17:04:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (create_handle_box): Set the policy
to auto_shrink - otherwise the appearance is rather
strange when flipping between horizontal and vertical.
Mon Jun 28 09:29:52 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c: add ::default_width and ::default_height arguments.
(gtk_window_set_default_size): don't change a value if it's < 0.
queue a resize.
Sun Jun 27 11:00:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (gtk_text_insert): don't segfault on NULL inserts.
Mon Jun 28 12:08:25 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Don't
add an extra "/" when concating "/" + filename.
(From Matt Grossman <mattg@oz.net>)
Mon Jun 28 10:57:12 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (draw_cell_pixmap): Reset clip mask
for fg_gc if we set it for drawing pixmap.
Tue Jun 15 12:45:12 1999 Owen Taylor <otaylor@redhat.com>
Fixes from Peter Wainwright <prw@wainpr.demon.co.uk>
* gtk/gtkrc.c (gtk_rc_parse_engine): If rc_style->engine is
already set, call old engine's destroy function and
unref the old engine.
Thu Jun 10 17:59:38 1999 Tim Janik <timj@gtk.org>
* gtk/gtkdrawingarea.c (gtk_drawing_area_size): queue a resize.
Wed Jun 9 15:13:16 1999 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h: mark certain functions as internal.
Wed Jun 9 13:48:28 1999 Tim Janik <timj@gtk.org>
* gtk/gtkpreview.c (gtk_preview_set_expand): queue a resize if the
expand behaviour changed.
* gtk/gtklabel.c (gtk_label_set_pattern):
(gtk_label_set_justify):
(gtk_label_set_line_wrap):
don't bother invoking queue_clear, the reallocation does
that for us, always free_words so the upcoming resize will
relayout the label's contents.
Wed Jun 9 12:50:48 1999 Tim Janik <timj@gtk.org>
* applied argument implementation patches from Elena Devdariani
<elena@cogent.ca>.
* gtk/gtktoolbar.c: ::orientation, ::toolbar_style, ::space_size,
::space_style, ::relief
* gtk/gtkruler.c: ::lower, ::upper, ::position, ::max_size
* gtk/gtkpreview.c: ::expand
* gtk/gtkpaned.c: ::handle_size, ::gutter_size
* gtk/gtknotebook.c: ::homogeneous
* gtk/gtklabel.c: ::wrap
* gtk/gtklist.c: ::selection_mode
* gtk/gtkhandlebox.c: ::handle_position, ::snap_edge
* gtk/gtkcurve.c: ::curve_type, ::min_x, ::max_x, ::min_y, ::max_y
* gtk/gtkcolorsel.c: ::update_policy, ::use_opacity
* gtk/gtkclist.c: ::sort_type
* gtk/gtkcheckmenuitem.c: ::active, ::show_toggle
* gtk/gtkaspectframe.c: ::xalign, ::yalign, ::ratio, ::obey_child
Tue Jun 1 23:38:38 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c: Removed ill-thought-out part of last
comment.
Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_attach): Get the reference
counting right when we have to attach a new style
for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>)
* gtk/gtkstyle.c: Documented the refcounting
peculularities of gtk_style_attach.
1999-06-01 Tim Janik <timj@dhcpd7.redhat.com>
* gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid
window types.
* examples/packer/pack.c (main): use GTK_WINDOW_TOPLEVEL instead
of GTK_TOPLEVEL for creating the window.
1999-06-01 Tim Janik <timj@dhcpd7.redhat.com>
* gtk/gtkmain.c (gtk_init_check): don't segfault when --gtk-module is
the last argument (reported by Per Winkvist).
Tue May 25 13:13:12 1999 Owen Taylor <otaylor@redhat.com>
Fixes for invisible XOR lines (Frank Loemker
<floemker@TechFak.Uni-Bielefeld.DE>)
* gtk/gtkclist.c (gtk_clist_realize): Always use
a non-zero pixel for GDK_XOR.
* gtk/gtkvpaned.c gtk/gtkhpaned.c:
Use GDK_INVERT instead of GDK_XOR.
Wed May 12 21:56:40 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (adjust_adjustments): signal emit value_changed
signals if h/voffsets differ from adjustment values.
Reportet by Jerome Bolliet <bolliet@in2p3.fr>
Mon May 10 04:20:41 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): propagate
::selection-done emissions up to the topmost menu shell.
Fri May 7 10:15:14 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_scrollable): Unset
the user data on the window before destroying it.
* gtk/gtknotebook.c (gtk_notebook_unrealize): Add an
unrealize handler to take care of destroying
notebook->panel properly.
(Bug #1198 - Morten Welinder <terra@diku.dk>)
* gtk/gtktext.c (expand_scratch_buffer): Fix reversal
of g_new and g_realloc to stop memory leak. (Actually,
we could just use g_realloc(), but I'm not 100% sure
that is portable).
(Bug #1196 - Morten Welinder <terra@diku.dk>)
Wed Apr 21 00:42:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkplug.h: Removed stray GtkPlugButton declaration.
* gdk/gdkfont.c (gdk_text_measure): Fix the return value
for fontsets.
* gtk/gtkbutton.c (gtkbutton_expose): Fix warning
with bin/button confusion.
Thu May 6 04:53:26 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: in the ItemFactory test, link radio items together,
and show how preselection of radio items is done.
Sun May 2 13:31:14 1999 Tim Janik <timj@gtk.org>
* gtk/gtktreeitem.c (gtk_tree_item_set_subtree):
* gtk/gtktree.c (gtk_tree_add) (gtk_tree_insert):
* gtk/gtktoolbar.c (gtk_toolbar_insert_element):
* gtk/gtkpaned.c (gtk_paned_pack2) (gtk_paned_pack1):
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add):
* gtk/gtktable.c (gtk_table_attach):
* gtk/gtklist.c (gtk_list_insert_items):
* gtk/gtkmenushell.c (gtk_menu_shell_insert):
* gtk/gtknotebook.c (gtk_notebook_insert_page_menu):
* gtk/gtkpacker.c (gtk_packer_add_defaults) (gtk_packer_add):
* gtk/gtkbin.c (gtk_bin_add):
* gtk/gtkbox.c (gtk_box_pack_start) (gtk_box_pack_end):
* gtk/gtkfixed.c (gtk_fixed_put):
* gtk/gtklayout.c (gtk_layout_put):
general fixups to container_add logic. always realize child if
child->parent is realized, only map the child and queue a resize
if child and child->parent are both visible.
Fri Apr 30 09:02:28 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): use gtk_container_forall
instead of gtk_container_foreach to walk and unrealize children, so
composite children get also unrealized.
(gtk_widget_real_show): don't call gtk_widget_map() if we don't need to.
(gtk_widget_map): assert that the widget is visible (basic constrain).
(gtk_widget_real_map): assert that the widget is realized (basic
constrain).
Fri Apr 29 00:53:20 1999 Tim Janik <timj@gtk.org>
* gtk/gtkbindings.c (gtk_pattern_spec_init): plugged a memory leak.
Tue May 4 09:32:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am gtk/gtkrc.iso-8859-2: Add a gtkrc
file for iso-8859-2 locales.
* configure.in (ALL_LINGUAS): ALL_LINGUAS update.
Tue Apr 27 16:38:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Fix typo of static_sources for static_SOURCES.
(Pointed out by andy@rz.uni-karlsruhe.de and others).
Remove some suspicious and useless lines.
Tue May 4 08:44:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c (gtk_clist_draw, draw_rows): Use
width,height = 0, 0 to mean - here to edge of window,
instead of -1, -1, since the former is all we support.
Tue May 4 08:34:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main): Correctly free list nodes
when removing from quit_functions list.
Tue Apr 27 14:17:16 1999 Tim Janik <timj@gtk.org>
* gtk/gtkpacker.c (gtk_packer_size_request): remove unused variable.
Tue Apr 27 18:23:35 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
When redrawing characters on non-visible entry, use appropriate
'*' character. (Bug #1130 - Jean-Marc Jacquet <jm@littleigloo.org>)
Tue Apr 27 01:31:40 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (drag_dest_cell): compute destination cell
from drag coordinates.
(gtk_clist_drag_data_received) (gtk_clist_drag_motion):
use drag_dest_cell.
* gtk/gtktree (drag_dest_cell)
(gtk_ctree_drag_data_received) (gtk_ctree_drag_motion): likewise.
(Bug #1129)
Wed Apr 21 21:26:11 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_init): properly initialize
translate_* fields.
(gtk_item_factory_finalize): invoke translate_notify independant from
translate_data.
(gtk_item_factory_set_translate_func): likewise.
(gtk_item_factory_destroy): only remove ifactory pointer from those
widgets that belong to us (stupid me).
Mon Apr 19 12:05:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_style_init): Fixed leak of
rc_style list when lookup succeeeds.
Thu Apr 15 01:11:24 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (resync_selection):
* gtk/gtkclist.c (resync_selection): fixed undo_selection bug.
* gtk/gtkclist.c (gtk_clist_button_release): fixed resync_selection
bug.
Fri Apr 9 19:22:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c gtk/gtkdnd.c gtk/gtkmenuitem.c:
Add some missing GDK_THREADS_ENTER()/LEAVE around
timeouts. (Patches from Sebastian Wilhelmi <wilhelmi@ira.uka.de>)
Thu Apr 8 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_key_press): use gtk_widget_activate()
rather than emit_by_name.
* gtk/gtkeditable.c (gtk_editable_insert_text): keep a reference
on the widget across multiple signal emissions.
(gtk_editable_delete_text): same here.
(gtk_editable_class_init): set widget_class->activate_signal after
editable_signals[ACTIVATE] has been created.
Wed Apr 7 22:59:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpaned.c (gtk_paned_set_position): Don't clamp
position here prematurely -- we might not have the
right ->min_position and ->max_position yet.
Tue Apr 6 16:38:51 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c gdk/gdkselection.c: (gtk_selection_request):
Add error traps so if the other end of the connection
dies, we survive.
* gtk/gtkselection.c (gtk_selection_notify): Clean
up properly when selection property retrieval fails.
* gtk/gtkselection.c (gtk_selection_request): Correctly
reject SelectionRequest notifies where the handler
returns no data.
Tue Apr 6 12:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (gtk_drag_dest_leave): Only unhighlight
when we've previously highlighted.
* gtk/gtkdnd.c (gtk_drag_dest_handle_event): Don't
emit two "drag_leave" signals for Motif drops.
* gtk/gtkdnd.c (gtk_drag_source_handle_event): Send
back the correct status messages when dropping from
Motif onto a proxy window that is rejecting the
drop.
Sat Mar 27 23:32:13 1999 Tim Janik <timj@gtk.org>
* gtk/gtkarg.[hc]: added functions from GLE, gtk_arg_reset() to free
the value and reset type to GTK_TYPE_INVALID, and gtk_arg_values_equal()
to compare two argument values. added gtk_arg_to_valueloc() to set a
variable from an arg through its location (pointer).
* gtk/gtkobject.[hc]: implemented gtk_object_get() in terms of
gtk_object_arg_get() and gtk_arg_to_valueloc(), floats are collected
as gfloat*, uchars are collected as guchar*, ints are collected as
gint*, etc...
Mon Mar 29 17:45:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccelgroup.c gtk/gtkgtkbindings.c:
Include <string.h> instead of <strings.h>.
* gtk/gtkstyle.c: Fix double include of gtkthemes.h
(actually, a lot more duplicate includes occur if
you trace through the sequence of #include's)
gtk-jbb-990320-0: John Bley, jbb6@acpub.duke.edu
Mon Mar 29 17:02:58 1999 Owen Taylor <otaylor@redhat.com>
Patches from Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>
gtk-a-higuti-990322-[0-3]
* configure.in: Fix confusion between GTK_LOCALE_[C]FLAGS
that was causing -DX_LOCALE not to work.
* gtk/gtkrc.c (gtk_rc_init):
X_LOCALE will never have LC_MESSAGES defined
Thu Mar 25 12:38:31 1999 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_append_default_module_path): get $HOME from
g_get_home_dir() (gtk-pmc-990123-0.patch.gz).
* gtk/gtkwindow.c (gtk_window_key_press_event): feature keypad up/down/
left/right as well (gtk-michael-980726-0.patch.gz).
* gtk/gtklabel.[hc]: bunch of miscellaneous cleanups, such as s/0/NULL/
for pointer values, use gchar instead of char. fixed uline allocation
leaks, changed the allocation pattern so we use G_ALLOC_AND_FREE mem
chunks instead of G_ALLOC_ONLY.
(gtk_label_size_request): always alter requisition as passed and leave
widget->requisition alone.
(gtk_label_set_text): allow NULL strings.
(gtk_label_new): likewise.
Wed Mar 24 09:24:03 1999 Tim Janik <timj@gtk.org>
* gtk/gtkdrawingarea.[hc]: type/macro fixups.
Mon Mar 22 05:51:34 1999 Tim Janik <timj@gtk.org>
* gtk/gtkbin.c (gtk_bin_draw): only redraw children that are visible
*and* mapped (i.e. drawable).
(gtk_bin_expose): only send exposes to drawable children.
* gtk/gtkbox.c (gtk_box_draw): only redraw children that are drawable.
(gtk_box_expose): only send exposes to drawable children.
* gtk/gtkhscale.c (gtk_hscale_draw):
* gtk/gtkvscale.c (gtk_vscale_draw):
hm, this is an ugly one. we first compute the size of our trough area
here (window relative) and then check intersection with the draw_area
which is parent relative because we're a NO_WINDOW widget, so we need
to offset the trough area by allocation.x and allocation.y before the
check. (this must not be done for the background area though, since
that's already computed parent relative).
Mon Mar 22 00:41:39 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_unrealize): unmap clist if neccessary,
unrealize title buttons.
Fri Mar 19 00:00:22 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_column_title_passive)
(gtk_clist_column_title_active):
only connect/disconnect to GtkWidgetClass::event to block mouse events.
* gtk/gtkclist.c (vertical_timeout) (horizontal_timeout):
zero initialize event, removed superfluous gdk_window_get_pointer call
* gtk/gtklist.c (gtk_list_vertical_timeout)
(gtk_list_horizontal_timeout): removed superfluous
gdk_window_get_pointer call
Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org>
* plugging problems reported by "Bruce Mitchener, Jr."
<bruce@puremagic.com> due to a purify session.
* gtk/gtkstyle.c:
(gtk_style_ref):
(gtk_style_unref): assert ref_count to be > 0.
* gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize
the requisition.
(gtk_clist_set_shift): likewise.
* gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the
adjustments.
* gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the
event before sending it and set send_event to TRUE (which needs to
be done for *all* synthesized events).
(gtk_list_vertical_timeout): likewise.
* gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory
leaks.
* gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event
to TRUE when synthesizing events.
[ *** end of merges from 1.2 *** ]
1999-11-22 21:52:50 +00:00
|
|
|
gtk_file_selection_fileop_error (fs, buf);
|
1998-01-21 07:53:07 +00:00
|
|
|
}
|
2001-03-12 15:39:19 +00:00
|
|
|
|
|
|
|
out:
|
1998-01-21 07:53:07 +00:00
|
|
|
g_free (full_path);
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_full_path);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
gtk_widget_destroy (fs->fileop_dialog);
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (fs, "", FALSE, TRUE);
|
1998-01-21 07:53:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_file_selection_delete_file (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
|
|
|
GtkFileSelection *fs = data;
|
|
|
|
GtkWidget *dialog;
|
2001-10-23 16:02:23 +00:00
|
|
|
const gchar *filename;
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
|
|
|
|
|
|
if (fs->fileop_dialog)
|
2002-02-11 21:17:11 +00:00
|
|
|
return;
|
1998-01-21 07:53:07 +00:00
|
|
|
|
1999-10-06 19:47:24 +00:00
|
|
|
#ifdef G_WITH_CYGWIN
|
2000-08-12 07:25:55 +00:00
|
|
|
translate_win32_path (fs);
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
filename = gtk_entry_get_text (GTK_ENTRY (fs->selection_entry));
|
2000-08-12 07:25:55 +00:00
|
|
|
if (strlen (filename) < 1)
|
|
|
|
return;
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2001-10-23 16:02:23 +00:00
|
|
|
g_free (fs->fileop_file);
|
|
|
|
fs->fileop_file = g_strdup (filename);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
/* main dialog */
|
2002-02-11 21:17:11 +00:00
|
|
|
fs->fileop_dialog = dialog =
|
|
|
|
gtk_message_dialog_new (GTK_WINDOW (fs),
|
|
|
|
GTK_WINDOW (fs)->modal ? GTK_DIALOG_MODAL : 0,
|
|
|
|
GTK_MESSAGE_QUESTION,
|
|
|
|
GTK_BUTTONS_NONE,
|
2004-01-06 13:52:51 +00:00
|
|
|
_("Really delete file \"%s\"?"), filename);
|
2002-02-11 21:17:11 +00:00
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (dialog, "destroy",
|
|
|
|
G_CALLBACK (gtk_file_selection_fileop_destroy),
|
|
|
|
fs);
|
1998-12-14 17:39:58 +00:00
|
|
|
gtk_window_set_title (GTK_WINDOW (dialog), _("Delete File"));
|
1998-11-28 07:42:37 +00:00
|
|
|
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
/* buttons */
|
2002-02-11 21:17:11 +00:00
|
|
|
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_DELETE, GTK_RESPONSE_OK,
|
|
|
|
NULL);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2002-02-11 21:17:11 +00:00
|
|
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (dialog, "response",
|
2002-02-11 21:17:11 +00:00
|
|
|
G_CALLBACK (gtk_file_selection_delete_file_response),
|
|
|
|
fs);
|
2001-11-02 20:02:44 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
gtk_widget_show (dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_file_selection_rename_file_confirmed (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
|
|
|
GtkFileSelection *fs = data;
|
|
|
|
gchar *buf;
|
2001-10-23 16:02:23 +00:00
|
|
|
const gchar *file;
|
1998-01-21 07:53:07 +00:00
|
|
|
gchar *path;
|
|
|
|
gchar *new_filename;
|
|
|
|
gchar *old_filename;
|
2000-08-12 07:37:27 +00:00
|
|
|
gchar *sys_new_filename;
|
|
|
|
gchar *sys_old_filename;
|
1998-01-21 07:53:07 +00:00
|
|
|
CompletionState *cmpl_state;
|
2001-03-12 15:39:19 +00:00
|
|
|
GError *error = NULL;
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
|
|
|
|
|
|
file = gtk_entry_get_text (GTK_ENTRY (fs->fileop_entry));
|
|
|
|
cmpl_state = (CompletionState*) fs->cmpl_state;
|
|
|
|
path = cmpl_reference_position (cmpl_state);
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
new_filename = g_strconcat (path, G_DIR_SEPARATOR_S, file, NULL);
|
|
|
|
old_filename = g_strconcat (path, G_DIR_SEPARATOR_S, fs->fileop_file, NULL);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2001-03-12 15:39:19 +00:00
|
|
|
sys_new_filename = g_filename_from_utf8 (new_filename, -1, NULL, NULL, &error);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
if (g_error_matches (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
|
|
|
|
buf = g_strdup_printf (_("The file name \"%s\" contains symbols that are not allowed in filenames"), new_filename);
|
|
|
|
else
|
|
|
|
buf = g_strdup_printf (_("Error renaming file to \"%s\": %s\n%s"),
|
|
|
|
new_filename, error->message,
|
|
|
|
_("You probably used symbols not allowed in filenames."));
|
|
|
|
gtk_file_selection_fileop_error (fs, buf);
|
|
|
|
g_error_free (error);
|
|
|
|
goto out1;
|
|
|
|
}
|
2000-08-12 07:37:27 +00:00
|
|
|
|
2001-03-12 15:39:19 +00:00
|
|
|
sys_old_filename = g_filename_from_utf8 (old_filename, -1, NULL, NULL, &error);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
if (g_error_matches (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
|
|
|
|
buf = g_strdup_printf (_("The file name \"%s\" contains symbols that are not allowed in filenames"), old_filename);
|
|
|
|
else
|
|
|
|
buf = g_strdup_printf (_("Error renaming file \"%s\": %s\n%s"),
|
|
|
|
old_filename, error->message,
|
|
|
|
_("It probably contains symbols not allowed in filenames."));
|
|
|
|
gtk_file_selection_fileop_error (fs, buf);
|
|
|
|
g_error_free (error);
|
|
|
|
goto out2;
|
|
|
|
}
|
|
|
|
|
2004-12-12 21:09:13 +00:00
|
|
|
if (g_rename (sys_old_filename, sys_new_filename) < 0)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
2001-03-12 15:39:19 +00:00
|
|
|
buf = g_strdup_printf (_("Error renaming file \"%s\" to \"%s\": %s"),
|
|
|
|
sys_old_filename, sys_new_filename,
|
|
|
|
g_strerror (errno));
|
Adapt cast macros to standard.
Fri Nov 19 10:34:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkgamma.h: Adapt cast macros to standard.
[ Merges from 1.2 ]
Tue Nov 16 10:15:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_path):
If translation does not include a '/', use entire
translation instead of crashing.
Sun Oct 31 22:21:11 1999 Tim Janik <timj@gtk.org>
* docs/gtk_tut.sgml:
s/gtk_accel_group_attach/gtk_window_add_accel_group/.
Sat Oct 30 09:09:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_remove): Use
g_list_remove_link, not g_list_remove.
[ From Geert Bevin <gbevin@thunderstorms.org> ]
Sun Oct 24 07:41:40 1999 Tim Janik <timj@gtk.org>
* gtk/gtkclist.c (real_undo_selection): commented out g_print()
statement upon unselection (how the heck did that slip in?).
Sat Oct 23 03:03:08 1999 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (gtk_text_freeze):
(gtk_text_thaw): undraw/draw cursor here to avoid unnecessary scrolling
in frozen state (and aparently crashes). patch provided by Anders
Melchiorsen <and@kampsax.dtu.dk>.
Sat Oct 23 02:53:20 1999 Tim Janik <timj@gtk.org>
* fix insensitive default/focus widget activation,
reported by Matt Goodall <mgg@isotek.co.uk>.
* gtk/gtkwindow.c (gtk_window_key_press_event):
(gtk_window_activate_default):
(gtk_window_activate_focus):
return handled=FALSE for actiavtion of insensitive default
widgets. return handled=TRUE for activation of insensitive
focus widgets. don't activate in either case.
Tue Oct 19 09:55:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk-config.in (lib_gtk): Switch order of @x_cflags@
and $glib_cflags to match library order and in the
theory that an old version of GLib is more likely to
be in the include directory for X then vice-versa.
(Bug #2776)
Tue Oct 19 09:46:49 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Always use LC_CTYPE
to determine the locale for fontsets, not LC_MESSAGES;
the user may want English messages with a handling
for non-English languages. (LC_CTYPE=ru_RU LC_MESSAGES=fr_FR
will still be broken) (Bug #2891)
Tue Oct 19 20:36:42 1999 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
* gtk/gtkrc.ko: Fixed the wrong number of "*"'s.
Tue Oct 19 12:15:13 1999 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
* gtk/gtkrc.ko: Changed the Korean default fontset.
Fri Oct 8 02:32:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): Fix bug
where when scrolling to the left or top double exposes
were done, causing major slowdowns.
Thu Oct 7 18:31:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Always normalize codeset
names to lowercase and alphanumeric, before looking
them up.
* gtk/Makefile.am: Install codeset variant gtkrc files
with normalized names.
Thu Oct 7 22:52:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_popup_with_data): even
popup menus when the menu is already visible, but its parent
is still hidden, (happens after tornoff window got hidden).
Thu Oct 7 11:09:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (install-data-local): Fix
a typo where gtkrc.vi_VN.tcvn5712 wasn't getting
deleted, causing error messages on install.
Thu Oct 7 11:03:06 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtk[hv]paned.c (gtk_{h,v}paned_draw): Redraw
the handle as well, since we now sometimes ignore
exposes on the handle while resizing.
Wed Oct 6 18:02:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_append_default_pixmap_path): Fix stupid
extra g_free introduced in one of the last one or two
commits.
Wed Oct 6 16:38:36 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am gtk/gtkrc*: Make naming of gtkrc files
consistent, put each style that a gtkrc.* file creates
in a unique namespace, remove old files before installing.
Wed Oct 6 14:31:16 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Avoid leaking memory when
gtk_rc_init is called multiple times. (Yes, people who
do that have bugs in their code.)
Tue Oct 5 11:36:57 PDT 1999 Manish Singh <yosh@gimp.org>
* gtk/Makefile.am: listing gtkrc in gtkconf_DATA seems to barf.
Remove it since it's generated by the Makefile anyway
Tue Oct 5 02:43:41 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkinputcommon.h (gdk_input_device_new): Free
device->info.axes for core pointer.
Thu Sep 30 13:55:25 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (destroy_idle_test): Rename idle to
idle_id, to deal with obsolete, broken C libraries.
Mon Sep 27 02:50:15 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkvscale.c (gtk_vscale_draw): Don't add in
allocation->x/y twice!
* gtk/gtkhscale.c: Make usage of gtk_hscale_pos_trough()
consistent with gtk_vscale_pos_trough().
Sun Sep 26 19:44:34 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcontainer.c (gtk_container_queue_resize): We may
be queueing a resize on a toplevel container between
the time we show it and when we map it. So, we need
to test GTK_WIDGET_VISIBLE() for toplevels, and only
use GTK_WIDGET_DRAWABLE() for child windows.
Thu Sep 23 16:41:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDADDS): Add GDK_WLIBS to LDADDS
(fixes bug #2144)
Fri Sep 24 00:51:45 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_queue_resize): check for
container DRAWABLE (instead of VISIBLE), so we don't queue
resizes on non-toplevel containers.
Sun Sep 19 18:13:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.[ch]: Make the data argument
const guchar *.
Sat Sep 18 21:27:40 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c: Try to behave sensibly if
the focus widget is the window itself. (Should
we allow this at all?)
Fri Sep 17 09:57:15 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_set_sensitive):
* gtk/gtknotebook.c (gtk_notebook_set_scrollable):
* gtk/gtknotebook.c (gtk_notebook_set_show_border):
* gtk/gtkclist.c (gtk_notebook_set_show_border): make gboolean args
in prototypes and implementations consistent (Tomas Ogren).
* gtk/gtklayout.c (gtk_layout_remove): unset GTK_IS_OFFSCREEN flag
before the widget is unparented (reported by damon).
* gtk/gtkdnd.c: make the cursor and icon data _unsigned_ char,
since we provide unsigned data anyways.
Thu Sep 16 21:32:01 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c (gtk_tooltips_set_tip): Delay
the call to gtk_tooltips_layout_text() until later.
* gtk/gtktooltips.c (gtk_tooltips_draw_tips):
Call gtk_widget_ensure_style() before using the style.
Wed Sep 15 02:52:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_event): Added workaround
for old widgets that don't propagate draws to all
children. (Namely gnome-dock for gnome-libs <= 1.0.16)
Tue Sep 14 19:22:19 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): don't queue the parent
for a redraw but just the widget that requested the resize.
Tue Sep 14 18:29:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: added new widget level method
gtk_container_set_reallocate_redraws() and a GtkContainer flag
reallocate_redraws : 1 to reflect the setting, exported this through
the argument system as a boolean ::reallocate_redraws.
* gtk/gtkwidget.c (gtk_widget_size_allocate): when queueing redraws
on the widget because the allocation changes, do so as well for
widget->parent if the parent has reallocate_redraws set to TRUE.
with that containers requesting reallocation redraws get automatically
redrawn if their children changed allocation (this unfortunately
affects also other children that didn't change allocation, but we
cannot work around that before 1.3).
Tue Sep 14 18:23:01 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_idle_draw): only emit ::draw if width
_and_ height are >0 (not _or_).
* gtk/gtktable.c (gtk_table_remove): use gtk_widget_queue_resize()
instead of gtk_container_queue_resize(), which is a core gtk internal
function (must have been on crack when i queued that).
* gtk/gtkprivate.h: added new private flag GTK_FULLDRAW_PENDING, so
we can check more reliably if we want to discard expose events.
* gtk/gtkwidget.c: added setting/unsetting of the GTK_FULLDRAW_PENDING
flag.
* gtk/gtkwidget.c (gtk_widget_event): don't discard synthesized exposes,
we simply trust these events. for deciding whether to discard exposes,
check GTK_FULLDRAW_PENDING instead of RESIZE_PENDING.
Mon Sep 13 15:01:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_queue_clear_area): Ignore
queues of areas that are completely off screen.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Fix broken
logic for handleboxes.
* gtk/gtkwidget.c (gtk_widget_queue_draw_data): Add santity
check on width/height.
Mon Sep 13 02:22:47 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am: backed out Raja's recent VPATH build "improvements",
we are fine with using $@ the way we do (if we actually encounter
brokeness with $@ in VPATH builds because of additional path prefixes,
we need to use $(@F) actually).
Mon Sep 13 01:34:53 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: renamed two variables, hopefully didn't introduce
short lived bugs, that would allow language bindings to do surgeries
to our guts.
Fri Sep 10 15:22:50 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_size_allocate): Fix typo
where comparison was being done against an uninitialized
value causing intermittant results depending on
compiler flags. Also make it clearer that we aren't
ever initializing the child as 0x0 (though this will
be caught in gtk_widget_size_allocate())
Fri Sep 10 10:06:56 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_set_transient_for): Move
gtk_window_unset_transient_for() call after we do checks
involving the old transient parent.
[ From Lance Capser <lmc@cyberhighway.net> ]
1999-09-07 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (gtk.defs): Go back to using `touch' to create
an empty file.
Mon Sep 6 00:11:56 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_is_ancestor): return FALSE if node has
no children. (Reported by: Chris Rogers <gandalf@pobox.com>)
1999-09-03 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (gen_sources): Improve VPATH builds.
`$@' is valid only in the build dir, not after we've done
`cd $srcdir'. Also use `test -f' instead of less portable
`test -e'.
Fri Sep 3 15:59:56 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (correct_cache_insert): Rewrite
for simplicity, and hopefully correctness.
(Fixes bug #1322, which was a segfault when
on some insertions with the properties around
the insertion set up just wrong.)
* gtk/gtktext.c (gtk_text_adjustment): When we receive
a "changed" signal, clamp the new value to the adjustment
bounds to avoid segfaulting if someone tries to change
the adjustment to a bogus value. (Bug #1795)
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness
problem that was causing background to sometimes
be misaligned.
Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
[ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
* gtk/gtkmenu.c (gtk_menu_position): Make
sure we never position menus with negative x, y,
since gtk_widget_set_uposition() can't handle that.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
Modify the positioning code a bit so that we always
put the top-left corner onscreen. (This is for
UI reasons, gtk_menu_position() now takes care of
gtk_widet_set_uposition() brokeness.)
Fri Sep 3 03:06:30 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am: fixed up things for -jx, x > 1.
Sun Sep 5 08:48:51 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_style): Ref the
RC style that is passed in. The lack of the ref
before was a bug. If people worked around this
bug, this will introduce a slight memory leak
in their code. The code should typically look like:
rc_style = gtk_rc_style_new ();
[...]
gtk_widget_modify_style (widget, rc_style);
gtk_rc_style_unref (rc_style);
* gtk/gtkwidget.c (gtk_widget_modify_style): Reset
the style if it was already set.
* gtk/gtkwidget.c (gtk_widget_set_name): Only set the
style if it was set before.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (main): Add a check to see if we
are being run from the correct directory and
to quit nicely if we are not.
* gtk/gtkrc.c (gtk_rc_slist_remove_all): Make function
static.
Thu Sep 2 23:00:03 1999 Tim Janik <timj@gtk.org>
* gtk/gtkenums.h (GtkWindowPosition): added GTK_WIN_POS_CENTER_ALWAYS.
* gtk/gtkwindow.c:
queue resizes unconditionally (gtk_widget_queue_resize will figure
what to do if the window is not realized).
(gtk_window_move_resize): only recenter the window
for GTK_WIN_POS_CENTER_ALWAYS.
(gtk_window_compute_reposition): handle GTK_WIN_POS_CENTER_ALWAYS in
the same way as GTK_WIN_POS_CENTER.
Thu Sep 2 22:39:27 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_reposition): check for the last position
with (!(info->last_flags & GDK_HINT_POS)) instead of
(!info->last_flags & GDK_HINT_POS).
* gtk/gtkwindow.c (gtk_window_move_resize): constrain new_width and
new_height unconditionally, because we use these values even if
!default_size_changed && !hints_changed.
comented the (default_size_changed || hints_changed) case with
respect to resize rejects from the window manager.
* gtk/gtkwindow.c (gtk_window_move_resize): save info->last values
in the zvt condition hack, since this includes the window hints, set
the hints after the handling_resize case.
* gtk/gtkwindow.c (gtk_window_show): constrain the default size that a
window is initially shown with to the geometry.
Thu Sep 2 07:38:56 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize):
s/size_changed/default_size_changed/g so i know what's
really going on (frying brain on smaller flame now).
Thu Sep 2 05:47:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize): queue a new resize if
we have size_changed upon handling_resize. this is a gross
workaround for the broken zvt widget and should be removed in
1.3 again (search for FIXME).
Owen provided an accurate comment for this:
/* We could be here for two reasons
* 1) We coincidentally got a resize while handling
* another resize.
* 2) Our computation of size_changed was completely
* screwed up, probably because one of our children
* is broken. It's probably a zvt widget.
*
* For 1), we could just go ahead and ask for the
* new size right now, but doing that for 2)
* might well be fighting the user (and can even
* trigger a loop). Since we really don't want to
* do that, we requeue a resize in hopes that
* by the time it gets handled, the child has seen
* the light and is willing to go along with the
* new size. (this happens for the zvt widget, since
* the size_allocate() above will have stored the
* requisition corresponding to the new size in the
* zvt widget)
*
* This doesn't buy us anything for 1), but it shouldn't
* hurt us too badly, since it is what would have
* happened if we had gotten the configure event before
* the new size had been set.
*/
Wed Sep 1 20:46:11 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: deal properly with the fact that RC
style lists may include rc styles more than once.
* gtk/gtkrc.c (gtk_rc_append_pixmap_path): Removed
unused static function.
* gtk/gtkrc.c (gtk_rc_find_pixmap_in_path): Keep a
stack of directories of RC files currently being
parsed and implicitely add them to pixmap path.
This fixes a bug where the directory would get
appended then overwritten by pixmap_path declarations.
(bug #1462, from Peter Wainright <prw@wainpr.demon.co.uk>)
* gtk/gtkthemes.c (gtk_theme_engine_unref): Call
theme's exit function. (Patch from Peter Wainwright,
bug #1454)
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_destroy):
Add a destroy() handler to take care of removing
group for menu item. (Fixes bug #1197)
* gtk/gtkwidget.c (gtk_widget_size_request): Fixed thinko
in warning message.
Wed Sep 1 21:27:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize): don't require a server
roundtrip to figure window's width and height, since we know that
anyways from widget->allocation.
Wed Sep 1 12:37:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Compute
the hints after we request the new size.
Wed Sep 1 10:38:37 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_compute_hints): Removed
GTK_WIDGET_REALIZED() assertion - we can compute the
hints before we are realized.
* gtk/gtkwindow.c (gtk_window_move_resize): Reorder
hint changing so that we have a value of hints_changed
when we decide whether to constrain the window size.
* gtk/gtkwindow.c (gtk_window_move_resize): Spelling fix.
* gtk/gtkwindow.c (gtk_window_constrain_size): cleanups,
change back to G_MAXINT.
Wed Sep 1 06:54:59 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_get_geometry_info): zero initialize
new GtkWindowGeometryInfo, so fields like GdkGeometry geometry
contain uncluttered values.
(gtk_window_compute_hints): simply assert that window is realized
and that geometry_info is valid, since we rely on this anyways.
(gtk_window_constrain_size): major cleanups to the code.
if (flags & GDK_HINT_BASE_SIZE) use geometry's base width and height
for the base size, instead of the minimums. use 32767 as max width
and height (like in gtkwindow.c) instead of G_MAXINT.
Wed Sep 1 04:41:25 1999 Tim Janik <timj@gtk.org>
* cleaned up the GtkContainer.need_resize flag handling mess, we
only need to force resize requests when we were prematurely
realized, or our widget tree was modified when we were temporarily
hidden. handling these cases directly upon showing the window (i.e.
while the GdkWindow is still unmapped) avoids the need to wait for
a configure event response and therefore makes the GUI more snappier
and avoids blank windows during the roundtrip.
* gtk/gtkwidget.c:
(gtk_widget_hide):
(gtk_widget_show): don't queue resizes on toplevels, they know how
to deal with matters.
* gtk/gtkcontainer.c (gtk_container_queue_resize): set the ->need_resize
flag directly for not visible resize containers and spare us unecessary
signal emissions.
* gtk/gtkwindow.c:
(gtk_window_realize): if we need to enforce premature size allocation,
queue a container resize so we are correctly resized later on.
(gtk_window_init):
(gtk_window_size_request):
don't freak around with the ->need_resize flag,
gtk_container_queue_resize() will care about that.
(gtk_window_show):
handle initial resizing issues here, we can handle matters better in
this place, especially since we know that our GdkWindow is still
unmapped.
(gtk_window_move_resize):
don't care about ->need_resize at all.
handle size changes properly that occoured while we waited for a
configure event.
Tue Aug 31 15:58:46 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_uposition):
* gtk/gtkwindow.[hc] (gtk_window_reposition):
Move the hint setting code from gtk_widget_set_uposition
to here; set the hints so that we respect any previously
set geometry hints.
* gtk/gtkwindow.c (gtk_window_compute_reposition): Don't
change the window hints here or move the window here,
let that happen in gtk_window_move_resize().
Tue Aug 31 06:58:52 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_event): when discarding exposes due
to already queued resizes (and therefore redraws) on a widget, check
its anchestry as well.
* gtk/gtkcontainer.c:
(gtk_container_queue_resize): clear resize widgets for resize
containers before aborting prematurely. this is especially important
for toplevels which may need imemdiate processing or their resize
handler to be queued.
(gtk_container_dequeue_resize_handler): added new internal function for
gtkwindow.c.
* gtk/gtkwindow.c (gtk_window_move_resize): if we are resizing due to a
configure event, take possible changes in window position into account
as well.
if we request a new window size, queue up a resize handler that will
last until the configure event response arrives.
combined the ->need_resize case (initial show) with the general size
(hints) changed case and added even more comments.
if !auto_shrink, only revert to the old allocation if the new size
is smaller than the current allocation.
Tue Aug 31 11:55:20 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_set_arg, gtk_window_set_policy,
gtk_window_set_geometry_hints
gtk_window_set_default_size):
When hints are set, queue a resize so that the hints will
be eventually reset on the toplevel.
* gtk/gtkwindow.c (gtk_window_show): Use
gtk_window_compute_default_size(). Clear the need_resize flag
on the initail map so that we don't unnecessarily trigger the
resize code.
* gtk/gtkwindow.c (gtk_window_move_resize): Split apart
into separate functions. Compare the hints we are setting
with what we set last time so that we can accurately
tell when we need to reset the hints.
* gtk/gtkwindow.c (gtk_window_compute_default_size): New
function to figure out the size from requisition
and default_size.
* gtk/gtkwindow.c (gtk_window_constrain_size): Function
from fvwm to constrain a size to the geometry hints.
* gtk/gtkwindow.c (gtk_window_compare_hints): New function
to compare two sets of geometry hints.
* gtk/gtkwindow.c (gtk_window_compute_hints): Renamed
from gtk_window_set_hints(), just compute the hints,
don't set them.
* gtk/gtkwindow.c (gtk_window_compute_reposition): Move
code from gtk_window_move_resize() to separate function,
rationalize a bit.
Tue Aug 31 13:05:03 1999 Owen Taylor <otaylor@redhat.com>
* gtkrc.h: Move the ref_count member out of the GtkRcStyle
structure into a new private structure.
* gtkrc.c: Split GtkRcStyle into public/private.
In the private part, add a list of pointers to the
RcStyle lists this RcStyle participates in.
* gtkrc.c: When a RcStyle is free, remove all
lists referencing it from the
realized_style_ht hash, and free those lists.
* gtk/gtkrc.c (gtk_rc_clear_styles): Don't call
gtk_rc_init(), since that adds the default styles
to the list of parsed RC files again.
* gtk/gtkrc.c: Use gtk_rc_style_find() consistently.
Thu Aug 26 14:14:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): reactivated the sanity
checks that ensure that a widget's allocation is at least 1 in width
and height. (GNOME note: this doesn't affect old panel code anymore,
because GtkSocket will request width and height of at least 1 since
Fri Jul 23).
* gtk/gtkwindow.c (gtk_window_realize): if the widget hasn't been
allocated yet (happens if the user realizes the window prematurely),
size request and allocate it.
(gtk_window_size_allocate): guard against guint underflows.
Wed Aug 25 19:01:36 1999 Lars Hamann <lars@gtk.org>
* gtk/Makefile.am (gtk_built_sources): reordered stamp-gtk.defs
in gtk_built_sources, so gtk.defs gets built prior to all other
sources.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am:
invoke indent on gtkmarshal.*.
rewrote source generation rules, use COPYING as oldest source tag for
a piggyback rule to generate all sources from (don't touch it ;).
major cleanups, strip spaces on build rules for GNU Make.
* gtk/genmarshal.pl: don't operate on hardcoded filenames but take
source and target files from commandline arguments. don't invoke indent.
Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_real_switch_page): queue_resize
notebook after switch to avoid drawing problems.
(Bug#856 Reported by: Theodore Roth <troth@netmagic.net>)
(gtk_notebook_pages_allocate): don't map not visible tab_labels,
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_real_switch_page): queue_resize
notebook after switch to avoid drawing problems.
(Bug#856 Reported by: Theodore Roth <troth@netmagic.net>)
(gtk_notebook_pages_allocate): don't map not visible tab_labels,
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
we use window->need_resize from configure_event now, to indicate that
the gtkwindow should keep its allocation (e.g. because the user resized
the window through window manager handles). resize_count is now reliably
used to figure whether we got the allocation we requested from the
window manager.
configure events get queued as resizes now, the real stuff (size
computation and allocation) now only goes on in gtk_window_move_resize().
GtkWindow's requisition now contains its *real* requisition (like all
other widgets), *not* taking usize into account.
geometry_info->last_{width|height} is now updated from set_hints() only
so it always contains the last hints we set for the window manager.
made some event handlers return TRUE instead of FALSE.
the overall code should be much more straight forward now, and the
significant code portions are accompanied by comments now.
(gtk_window_set_hints):
removed requisition argument and made it
fetch the requisition through gtk_widget_get_child_requisition.
we also don't move the gdkwindow here anymore, gtk_window_move_resize()
does that now.
(gtk_window_show):
ensure that the widget is realized before calling
gtk_container_check_resize() (and thus gtk_window_move_resize()), also
ensure that we got properly size requested and allocated before
realization.
(gtk_window_configure_event):
ignore plain window moves, or reallocate the widget tree through the
resize queue otherwise.
(gtk_window_move_resize):
mostly rewrote this function to figure window manager hints more
reliably, coalesce window moves and resizes to reduce configure events
and do actuall size allocations.
Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_event): discard expose events for widgets
that have a resize pending, because a redraw is already queued for them.
* gtk/gtkcontainer.c: removed ugly connect_to ::size_allocate signal
hack to clear resize_widgets.
* gtk/gtkwidget.c (gtk_widget_size_allocate): call clear_resize_widgets
for resize containers prior to size allocation. (this is also a bit
ugly, but avoids side effects for stopped emissions and is thus more
reliable).
(gtk_widget_unparent): removed disconnect call for clear_resize_widgets.
* gtk/gtktooltips.c (gtk_tooltips_paint_window): renamed this
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
checks.
(gtk_target_list_unref): Likewise.
* gtk/gtkthemes.c (gtk_theme_engine_unref): Likewise.
Tue Aug 17 15:47:07 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar):
guard against division by zero. (Fixes bug #1339)
Tue Aug 17 10:56:49 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_move_{forward,backward}_word):
Prevent the trivial leak of information of allowing
word motion when the entry is not visible.
Tue Aug 17 10:28:52 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_fileop_error): Propagate
modality to error dialog as well as confirmation dialogs.
(Bug #1803, reported by Rosanna Wing Sze Yuen)
Wed Aug 11 01:04:57 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreeitem.c (gtk_tree_item_draw_lines): Honor
tree->view_lines.
(gtk-guy-990611-3.patch: Guy Harris <guy@netapp.com>)
* gtk/Makefile.am (install-data-local): Solaris apparently
has various troubles with ln -f; use rm first instead.
(gtk-guy-990611-2.patch: Guy Harris <guy@netapp.com>)
1999-07-30 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (stamp-m): Don't `mv' from builddir to srcdir,
use `cp' followed by `rm' (the `rm' was already there).
July 30, 1999 Elliot Lee <sopwith@redhat.com>
* configure.in: Fix autoconf warnings about cross compilation by
trying to provide sane defaults for AC_TRY_RUN.
* gtk/Makefile.am: If we refer to gtkmarshal.[ch] in $(srcdir),
put them into $(srcdir) when generated. Also add a dependency of
gtksignal.h on gtkmarshal.h for -j builds.
* gtk/gtk(dnd,style,gamma).c: Minor warning fixes.
Wed Jul 28 09:29:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main_iteration_do): Added missing
GDK_THREADS_{LEAVE,ENTER} pair.
(From Paul Fisher <pnfisher@redhat.com>)
Fri Jul 23 01:00:15 1999 Tim Janik <timj@gtk.org>
* gtk/gtksocket.c (gtk_socket_size_request): asure that the requested
width and height are always >0 (owen).
Fri Jul 23 00:00:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): backed out my recent
change that assured that a widget's allocated with and height are
always >1, since this breaks *buggy* panel code. unfortunately this
back-breaks the gimp's color selector.
* gtk/gtkdrawingarea.c (gtk_drawing_area_size_allocate): asure that our
allocation is always >0 in width and height, before sending the
configure event; this is a *gross* hack to get the gimp back to work.
* marked both cases with TODO-1.3
Wed Jul 21 15:47:39 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Don't display wrap indicators when
text is not editable and word wrap is on.
Wed Jul 21 08:21:40 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case
option menus here as they are not derived from menu shell, assure that
the option menu has a menu we can add items to.
Tue Jul 20 23:29:48 1999 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation->
width/height to (gint) before calculations and check against < 0 to
avoid guint wraparounds.
Sun Jul 18 00:35:49 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated
width and height is never zero. sanity check both dimensions against
32767 and issue a warning if the allocation is greater than that.
Wed Jul 7 15:03:30 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_events_pending): Unlock around call
to g_main_pending() as well.
Wed Jul 7 14:59:01 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main_iteration): Unlock around
call to g_main_iteration() - since that will regrab
GTK+ lock to process events.
Thu Jul 1 15:01:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c
- Regularize with the rest of GTK+ by making widget->requisition
not reflect the set_usize()
- Always recompute geometry hints, then check if they
changed before sending them to the X server. The
previous checks for changes would fail in a number
of circumstances.
Thu Jul 1 11:55:59 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c: Include <stdlib.h> for strcmp().
Wed Jun 30 19:26:36 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c:
- Code cleanups
- Instantaneously update on modifier key presses
- Allow cancellation of the drag with Escape.
Tue Jun 29 17:04:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (create_handle_box): Set the policy
to auto_shrink - otherwise the appearance is rather
strange when flipping between horizontal and vertical.
Mon Jun 28 09:29:52 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c: add ::default_width and ::default_height arguments.
(gtk_window_set_default_size): don't change a value if it's < 0.
queue a resize.
Sun Jun 27 11:00:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (gtk_text_insert): don't segfault on NULL inserts.
Mon Jun 28 12:08:25 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Don't
add an extra "/" when concating "/" + filename.
(From Matt Grossman <mattg@oz.net>)
Mon Jun 28 10:57:12 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (draw_cell_pixmap): Reset clip mask
for fg_gc if we set it for drawing pixmap.
Tue Jun 15 12:45:12 1999 Owen Taylor <otaylor@redhat.com>
Fixes from Peter Wainwright <prw@wainpr.demon.co.uk>
* gtk/gtkrc.c (gtk_rc_parse_engine): If rc_style->engine is
already set, call old engine's destroy function and
unref the old engine.
Thu Jun 10 17:59:38 1999 Tim Janik <timj@gtk.org>
* gtk/gtkdrawingarea.c (gtk_drawing_area_size): queue a resize.
Wed Jun 9 15:13:16 1999 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h: mark certain functions as internal.
Wed Jun 9 13:48:28 1999 Tim Janik <timj@gtk.org>
* gtk/gtkpreview.c (gtk_preview_set_expand): queue a resize if the
expand behaviour changed.
* gtk/gtklabel.c (gtk_label_set_pattern):
(gtk_label_set_justify):
(gtk_label_set_line_wrap):
don't bother invoking queue_clear, the reallocation does
that for us, always free_words so the upcoming resize will
relayout the label's contents.
Wed Jun 9 12:50:48 1999 Tim Janik <timj@gtk.org>
* applied argument implementation patches from Elena Devdariani
<elena@cogent.ca>.
* gtk/gtktoolbar.c: ::orientation, ::toolbar_style, ::space_size,
::space_style, ::relief
* gtk/gtkruler.c: ::lower, ::upper, ::position, ::max_size
* gtk/gtkpreview.c: ::expand
* gtk/gtkpaned.c: ::handle_size, ::gutter_size
* gtk/gtknotebook.c: ::homogeneous
* gtk/gtklabel.c: ::wrap
* gtk/gtklist.c: ::selection_mode
* gtk/gtkhandlebox.c: ::handle_position, ::snap_edge
* gtk/gtkcurve.c: ::curve_type, ::min_x, ::max_x, ::min_y, ::max_y
* gtk/gtkcolorsel.c: ::update_policy, ::use_opacity
* gtk/gtkclist.c: ::sort_type
* gtk/gtkcheckmenuitem.c: ::active, ::show_toggle
* gtk/gtkaspectframe.c: ::xalign, ::yalign, ::ratio, ::obey_child
Tue Jun 1 23:38:38 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c: Removed ill-thought-out part of last
comment.
Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_attach): Get the reference
counting right when we have to attach a new style
for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>)
* gtk/gtkstyle.c: Documented the refcounting
peculularities of gtk_style_attach.
1999-06-01 Tim Janik <timj@dhcpd7.redhat.com>
* gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid
window types.
* examples/packer/pack.c (main): use GTK_WINDOW_TOPLEVEL instead
of GTK_TOPLEVEL for creating the window.
1999-06-01 Tim Janik <timj@dhcpd7.redhat.com>
* gtk/gtkmain.c (gtk_init_check): don't segfault when --gtk-module is
the last argument (reported by Per Winkvist).
Tue May 25 13:13:12 1999 Owen Taylor <otaylor@redhat.com>
Fixes for invisible XOR lines (Frank Loemker
<floemker@TechFak.Uni-Bielefeld.DE>)
* gtk/gtkclist.c (gtk_clist_realize): Always use
a non-zero pixel for GDK_XOR.
* gtk/gtkvpaned.c gtk/gtkhpaned.c:
Use GDK_INVERT instead of GDK_XOR.
Wed May 12 21:56:40 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (adjust_adjustments): signal emit value_changed
signals if h/voffsets differ from adjustment values.
Reportet by Jerome Bolliet <bolliet@in2p3.fr>
Mon May 10 04:20:41 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): propagate
::selection-done emissions up to the topmost menu shell.
Fri May 7 10:15:14 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_scrollable): Unset
the user data on the window before destroying it.
* gtk/gtknotebook.c (gtk_notebook_unrealize): Add an
unrealize handler to take care of destroying
notebook->panel properly.
(Bug #1198 - Morten Welinder <terra@diku.dk>)
* gtk/gtktext.c (expand_scratch_buffer): Fix reversal
of g_new and g_realloc to stop memory leak. (Actually,
we could just use g_realloc(), but I'm not 100% sure
that is portable).
(Bug #1196 - Morten Welinder <terra@diku.dk>)
Wed Apr 21 00:42:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkplug.h: Removed stray GtkPlugButton declaration.
* gdk/gdkfont.c (gdk_text_measure): Fix the return value
for fontsets.
* gtk/gtkbutton.c (gtkbutton_expose): Fix warning
with bin/button confusion.
Thu May 6 04:53:26 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: in the ItemFactory test, link radio items together,
and show how preselection of radio items is done.
Sun May 2 13:31:14 1999 Tim Janik <timj@gtk.org>
* gtk/gtktreeitem.c (gtk_tree_item_set_subtree):
* gtk/gtktree.c (gtk_tree_add) (gtk_tree_insert):
* gtk/gtktoolbar.c (gtk_toolbar_insert_element):
* gtk/gtkpaned.c (gtk_paned_pack2) (gtk_paned_pack1):
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add):
* gtk/gtktable.c (gtk_table_attach):
* gtk/gtklist.c (gtk_list_insert_items):
* gtk/gtkmenushell.c (gtk_menu_shell_insert):
* gtk/gtknotebook.c (gtk_notebook_insert_page_menu):
* gtk/gtkpacker.c (gtk_packer_add_defaults) (gtk_packer_add):
* gtk/gtkbin.c (gtk_bin_add):
* gtk/gtkbox.c (gtk_box_pack_start) (gtk_box_pack_end):
* gtk/gtkfixed.c (gtk_fixed_put):
* gtk/gtklayout.c (gtk_layout_put):
general fixups to container_add logic. always realize child if
child->parent is realized, only map the child and queue a resize
if child and child->parent are both visible.
Fri Apr 30 09:02:28 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): use gtk_container_forall
instead of gtk_container_foreach to walk and unrealize children, so
composite children get also unrealized.
(gtk_widget_real_show): don't call gtk_widget_map() if we don't need to.
(gtk_widget_map): assert that the widget is visible (basic constrain).
(gtk_widget_real_map): assert that the widget is realized (basic
constrain).
Fri Apr 29 00:53:20 1999 Tim Janik <timj@gtk.org>
* gtk/gtkbindings.c (gtk_pattern_spec_init): plugged a memory leak.
Tue May 4 09:32:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am gtk/gtkrc.iso-8859-2: Add a gtkrc
file for iso-8859-2 locales.
* configure.in (ALL_LINGUAS): ALL_LINGUAS update.
Tue Apr 27 16:38:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Fix typo of static_sources for static_SOURCES.
(Pointed out by andy@rz.uni-karlsruhe.de and others).
Remove some suspicious and useless lines.
Tue May 4 08:44:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c (gtk_clist_draw, draw_rows): Use
width,height = 0, 0 to mean - here to edge of window,
instead of -1, -1, since the former is all we support.
Tue May 4 08:34:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main): Correctly free list nodes
when removing from quit_functions list.
Tue Apr 27 14:17:16 1999 Tim Janik <timj@gtk.org>
* gtk/gtkpacker.c (gtk_packer_size_request): remove unused variable.
Tue Apr 27 18:23:35 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
When redrawing characters on non-visible entry, use appropriate
'*' character. (Bug #1130 - Jean-Marc Jacquet <jm@littleigloo.org>)
Tue Apr 27 01:31:40 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (drag_dest_cell): compute destination cell
from drag coordinates.
(gtk_clist_drag_data_received) (gtk_clist_drag_motion):
use drag_dest_cell.
* gtk/gtktree (drag_dest_cell)
(gtk_ctree_drag_data_received) (gtk_ctree_drag_motion): likewise.
(Bug #1129)
Wed Apr 21 21:26:11 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_init): properly initialize
translate_* fields.
(gtk_item_factory_finalize): invoke translate_notify independant from
translate_data.
(gtk_item_factory_set_translate_func): likewise.
(gtk_item_factory_destroy): only remove ifactory pointer from those
widgets that belong to us (stupid me).
Mon Apr 19 12:05:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_style_init): Fixed leak of
rc_style list when lookup succeeeds.
Thu Apr 15 01:11:24 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (resync_selection):
* gtk/gtkclist.c (resync_selection): fixed undo_selection bug.
* gtk/gtkclist.c (gtk_clist_button_release): fixed resync_selection
bug.
Fri Apr 9 19:22:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c gtk/gtkdnd.c gtk/gtkmenuitem.c:
Add some missing GDK_THREADS_ENTER()/LEAVE around
timeouts. (Patches from Sebastian Wilhelmi <wilhelmi@ira.uka.de>)
Thu Apr 8 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_key_press): use gtk_widget_activate()
rather than emit_by_name.
* gtk/gtkeditable.c (gtk_editable_insert_text): keep a reference
on the widget across multiple signal emissions.
(gtk_editable_delete_text): same here.
(gtk_editable_class_init): set widget_class->activate_signal after
editable_signals[ACTIVATE] has been created.
Wed Apr 7 22:59:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpaned.c (gtk_paned_set_position): Don't clamp
position here prematurely -- we might not have the
right ->min_position and ->max_position yet.
Tue Apr 6 16:38:51 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c gdk/gdkselection.c: (gtk_selection_request):
Add error traps so if the other end of the connection
dies, we survive.
* gtk/gtkselection.c (gtk_selection_notify): Clean
up properly when selection property retrieval fails.
* gtk/gtkselection.c (gtk_selection_request): Correctly
reject SelectionRequest notifies where the handler
returns no data.
Tue Apr 6 12:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (gtk_drag_dest_leave): Only unhighlight
when we've previously highlighted.
* gtk/gtkdnd.c (gtk_drag_dest_handle_event): Don't
emit two "drag_leave" signals for Motif drops.
* gtk/gtkdnd.c (gtk_drag_source_handle_event): Send
back the correct status messages when dropping from
Motif onto a proxy window that is rejecting the
drop.
Sat Mar 27 23:32:13 1999 Tim Janik <timj@gtk.org>
* gtk/gtkarg.[hc]: added functions from GLE, gtk_arg_reset() to free
the value and reset type to GTK_TYPE_INVALID, and gtk_arg_values_equal()
to compare two argument values. added gtk_arg_to_valueloc() to set a
variable from an arg through its location (pointer).
* gtk/gtkobject.[hc]: implemented gtk_object_get() in terms of
gtk_object_arg_get() and gtk_arg_to_valueloc(), floats are collected
as gfloat*, uchars are collected as guchar*, ints are collected as
gint*, etc...
Mon Mar 29 17:45:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccelgroup.c gtk/gtkgtkbindings.c:
Include <string.h> instead of <strings.h>.
* gtk/gtkstyle.c: Fix double include of gtkthemes.h
(actually, a lot more duplicate includes occur if
you trace through the sequence of #include's)
gtk-jbb-990320-0: John Bley, jbb6@acpub.duke.edu
Mon Mar 29 17:02:58 1999 Owen Taylor <otaylor@redhat.com>
Patches from Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>
gtk-a-higuti-990322-[0-3]
* configure.in: Fix confusion between GTK_LOCALE_[C]FLAGS
that was causing -DX_LOCALE not to work.
* gtk/gtkrc.c (gtk_rc_init):
X_LOCALE will never have LC_MESSAGES defined
Thu Mar 25 12:38:31 1999 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_append_default_module_path): get $HOME from
g_get_home_dir() (gtk-pmc-990123-0.patch.gz).
* gtk/gtkwindow.c (gtk_window_key_press_event): feature keypad up/down/
left/right as well (gtk-michael-980726-0.patch.gz).
* gtk/gtklabel.[hc]: bunch of miscellaneous cleanups, such as s/0/NULL/
for pointer values, use gchar instead of char. fixed uline allocation
leaks, changed the allocation pattern so we use G_ALLOC_AND_FREE mem
chunks instead of G_ALLOC_ONLY.
(gtk_label_size_request): always alter requisition as passed and leave
widget->requisition alone.
(gtk_label_set_text): allow NULL strings.
(gtk_label_new): likewise.
Wed Mar 24 09:24:03 1999 Tim Janik <timj@gtk.org>
* gtk/gtkdrawingarea.[hc]: type/macro fixups.
Mon Mar 22 05:51:34 1999 Tim Janik <timj@gtk.org>
* gtk/gtkbin.c (gtk_bin_draw): only redraw children that are visible
*and* mapped (i.e. drawable).
(gtk_bin_expose): only send exposes to drawable children.
* gtk/gtkbox.c (gtk_box_draw): only redraw children that are drawable.
(gtk_box_expose): only send exposes to drawable children.
* gtk/gtkhscale.c (gtk_hscale_draw):
* gtk/gtkvscale.c (gtk_vscale_draw):
hm, this is an ugly one. we first compute the size of our trough area
here (window relative) and then check intersection with the draw_area
which is parent relative because we're a NO_WINDOW widget, so we need
to offset the trough area by allocation.x and allocation.y before the
check. (this must not be done for the background area though, since
that's already computed parent relative).
Mon Mar 22 00:41:39 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_unrealize): unmap clist if neccessary,
unrealize title buttons.
Fri Mar 19 00:00:22 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_column_title_passive)
(gtk_clist_column_title_active):
only connect/disconnect to GtkWidgetClass::event to block mouse events.
* gtk/gtkclist.c (vertical_timeout) (horizontal_timeout):
zero initialize event, removed superfluous gdk_window_get_pointer call
* gtk/gtklist.c (gtk_list_vertical_timeout)
(gtk_list_horizontal_timeout): removed superfluous
gdk_window_get_pointer call
Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org>
* plugging problems reported by "Bruce Mitchener, Jr."
<bruce@puremagic.com> due to a purify session.
* gtk/gtkstyle.c:
(gtk_style_ref):
(gtk_style_unref): assert ref_count to be > 0.
* gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize
the requisition.
(gtk_clist_set_shift): likewise.
* gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the
adjustments.
* gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the
event before sending it and set send_event to TRUE (which needs to
be done for *all* synthesized events).
(gtk_list_vertical_timeout): likewise.
* gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory
leaks.
* gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event
to TRUE when synthesizing events.
[ *** end of merges from 1.2 *** ]
1999-11-22 21:52:50 +00:00
|
|
|
gtk_file_selection_fileop_error (fs, buf);
|
2002-01-17 01:37:06 +00:00
|
|
|
goto out2;
|
1998-01-21 07:53:07 +00:00
|
|
|
}
|
2001-03-12 15:39:19 +00:00
|
|
|
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (fs, "", FALSE, FALSE);
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), file);
|
|
|
|
|
2001-03-12 15:39:19 +00:00
|
|
|
out2:
|
|
|
|
g_free (sys_old_filename);
|
|
|
|
|
|
|
|
out1:
|
1998-01-21 07:53:07 +00:00
|
|
|
g_free (new_filename);
|
|
|
|
g_free (old_filename);
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_new_filename);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
gtk_widget_destroy (fs->fileop_dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_file_selection_rename_file (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
|
|
|
GtkFileSelection *fs = data;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
gchar *buf;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
|
|
|
|
|
|
if (fs->fileop_dialog)
|
|
|
|
return;
|
|
|
|
|
2001-10-23 16:02:23 +00:00
|
|
|
g_free (fs->fileop_file);
|
|
|
|
fs->fileop_file = g_strdup (gtk_entry_get_text (GTK_ENTRY (fs->selection_entry)));
|
2000-08-12 07:25:55 +00:00
|
|
|
if (strlen (fs->fileop_file) < 1)
|
|
|
|
return;
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
/* main dialog */
|
|
|
|
fs->fileop_dialog = dialog = gtk_dialog_new ();
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (dialog, "destroy",
|
|
|
|
G_CALLBACK (gtk_file_selection_fileop_destroy),
|
|
|
|
fs);
|
1998-12-14 17:39:58 +00:00
|
|
|
gtk_window_set_title (GTK_WINDOW (dialog), _("Rename File"));
|
1998-11-28 07:42:37 +00:00
|
|
|
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fs));
|
1998-08-11 19:06:18 +00:00
|
|
|
|
|
|
|
/* If file dialog is grabbed, grab option dialog */
|
|
|
|
/* When option dialog closed, file dialog will be grabbed again */
|
2000-08-12 07:25:55 +00:00
|
|
|
if (GTK_WINDOW (fs)->modal)
|
|
|
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox,
|
|
|
|
FALSE, FALSE, 0);
|
1998-01-21 07:53:07 +00:00
|
|
|
gtk_widget_show(vbox);
|
|
|
|
|
2002-02-11 21:17:11 +00:00
|
|
|
buf = g_strdup_printf (_("Rename file \"%s\" to:"), fs->fileop_file);
|
|
|
|
label = gtk_label_new (buf);
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 5);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
g_free (buf);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
/* New filename entry */
|
|
|
|
fs->fileop_entry = gtk_entry_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), fs->fileop_entry,
|
|
|
|
TRUE, TRUE, 5);
|
2000-08-12 07:25:55 +00:00
|
|
|
GTK_WIDGET_SET_FLAGS (fs->fileop_entry, GTK_CAN_DEFAULT);
|
2003-05-21 22:54:53 +00:00
|
|
|
gtk_entry_set_activates_default (GTK_ENTRY (fs->fileop_entry), TRUE);
|
1998-01-21 07:53:07 +00:00
|
|
|
gtk_widget_show (fs->fileop_entry);
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (fs->fileop_entry), fs->fileop_file);
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_editable_select_region (GTK_EDITABLE (fs->fileop_entry),
|
|
|
|
0, strlen (fs->fileop_file));
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
/* buttons */
|
2003-05-21 22:54:53 +00:00
|
|
|
button = gtk_dialog_add_button (GTK_DIALOG (dialog),
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect_swapped (button, "clicked",
|
|
|
|
G_CALLBACK (gtk_widget_destroy),
|
|
|
|
dialog);
|
1998-08-11 19:06:18 +00:00
|
|
|
|
2001-10-29 18:44:15 +00:00
|
|
|
gtk_widget_grab_focus (fs->fileop_entry);
|
|
|
|
|
2003-05-21 22:54:53 +00:00
|
|
|
button = gtk_dialog_add_button (GTK_DIALOG (dialog),
|
|
|
|
_("_Rename"), GTK_RESPONSE_OK);
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (button, "clicked",
|
|
|
|
G_CALLBACK (gtk_file_selection_rename_file_confirmed),
|
|
|
|
fs);
|
2002-10-25 19:57:48 +00:00
|
|
|
g_signal_connect (fs->fileop_entry, "changed",
|
|
|
|
G_CALLBACK (gtk_file_selection_fileop_entry_changed),
|
|
|
|
button);
|
|
|
|
|
2003-05-21 22:54:53 +00:00
|
|
|
gtk_widget_grab_default (button);
|
2001-11-02 20:02:44 +00:00
|
|
|
|
1998-08-11 19:06:18 +00:00
|
|
|
gtk_widget_show (dialog);
|
1998-01-21 07:53:07 +00:00
|
|
|
}
|
|
|
|
|
2001-03-12 15:39:19 +00:00
|
|
|
static gint
|
|
|
|
gtk_file_selection_insert_text (GtkWidget *widget,
|
|
|
|
const gchar *new_text,
|
|
|
|
gint new_text_length,
|
|
|
|
gint *position,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
filename = g_filename_from_utf8 (new_text, new_text_length, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
if (!filename)
|
|
|
|
{
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
gdk_display_beep (gtk_widget_get_display (widget));
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_stop_emission_by_name (widget, "insert_text");
|
2001-03-12 15:39:19 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (filename);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2002-10-25 19:57:48 +00:00
|
|
|
static void
|
|
|
|
gtk_file_selection_update_fileops (GtkFileSelection *fs)
|
|
|
|
{
|
|
|
|
gboolean sensitive;
|
|
|
|
|
|
|
|
if (!fs->selection_entry)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sensitive = !entry_is_empty (GTK_ENTRY (fs->selection_entry));
|
|
|
|
|
|
|
|
if (fs->fileop_del_file)
|
|
|
|
gtk_widget_set_sensitive (fs->fileop_del_file, sensitive);
|
|
|
|
|
|
|
|
if (fs->fileop_ren_file)
|
|
|
|
gtk_widget_set_sensitive (fs->fileop_ren_file, sensitive);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint
|
|
|
|
gtk_file_selection_key_press (GtkWidget *widget,
|
|
|
|
GdkEventKey *event,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkFileSelection *fs;
|
|
|
|
char *text;
|
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
if ((event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab) &&
|
|
|
|
(event->state & gtk_accelerator_get_default_mod_mask ()) == 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
fs = GTK_FILE_SELECTION (user_data);
|
1999-10-06 19:47:24 +00:00
|
|
|
#ifdef G_WITH_CYGWIN
|
2000-08-12 07:25:55 +00:00
|
|
|
translate_win32_path (fs);
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
2001-10-23 16:02:23 +00:00
|
|
|
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (fs->selection_entry)));
|
1998-05-16 07:22:00 +00:00
|
|
|
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (fs, text, TRUE, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-05-16 07:22:00 +00:00
|
|
|
g_free (text);
|
|
|
|
|
reverted marius change to expose the type systems internal type info data
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapped accessors, ala gtk_signal_query().
* gtk/gtksignal.c (gtk_signal_connect_by_type): reverted marius change,
since it destroys the possibility to implement automatic marshaller
lookups some day, and it also disables third party code's ability to
connect to any signal. also the GtkTypeInfo structures are dynamically
allocated memory portions, so only the type system is really allowed
to access that stuff.
Mon Dec 7 01:32:18 1998 Tim Janik <timj@gtk.org>
* gtk/gtkfilesel.c (gtk_file_selection_key_press): always intercept the
Tab key on the entry. the focus shouldn't get lost even if completion
is attempted from an empty entry, since an empty entry string does
indeed have a valid completion meaning (complete all).
(gtk_file_selection_init): cast the gchar array parameter in calls to
gtk_clist_new_with_titles() to quit compiler warnings.
(check_dir): the no_stat_dirs struct must not be const, since we do
indeed modify its contents.
* gtk/testgtk.c (event_watcher): adapted prototype to fit new emission
hook semantics.
* gtk/gtksignal.h:
* gtk/gtksignal.c:
changed emission allocation, so we don't use a doubly linked list
but link ourselfs (singly linked).
changed emission hooks, they get the emision parameters passed as
well now and are emitted during the actuall signal emission (after
the RUN_FIRST class method, but prior to RUN_FIRST handlers).
the existing restrictions do still apply to signal emission hooks,
i.e. an emission may not be stopped or restarted from an emission hook.
due to possibly huge perfomance impacts, frequent use of emision hooks
is also not recommended.
(gtk_signal_next_and_invalidate): added an
assertments which explicits what the code assumes anyways: a
maximum amount of 65535 signals.
* gtk/gtkcontainer.h: deprecated gtk_container_foreach_interp(),
gtk_container_foreach_full() should be used instead.
* gtk/gtkmain.h:
deprecated gtk_timeout_add_interp and gtk_idle_add_interp, since
we provide _full variants.
* gtk/gtksignal.h: deprecated gtk_signal_connect_interp(), we provide
gtk_signal_connect_full() for long enough now.
1998-12-07 02:31:19 +00:00
|
|
|
return TRUE;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
gtk_file_selection_history_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
|
|
|
GtkFileSelection *fs = data;
|
|
|
|
HistoryCallbackArg *callback_arg;
|
|
|
|
GList *list;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
list = fs->history_list;
|
|
|
|
|
|
|
|
while (list) {
|
|
|
|
callback_arg = list->data;
|
|
|
|
|
|
|
|
if (callback_arg->menu_item == widget)
|
|
|
|
{
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (fs, callback_arg->directory, FALSE, FALSE);
|
1998-01-21 07:53:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
list = list->next;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
static void
|
|
|
|
gtk_file_selection_update_history_menu (GtkFileSelection *fs,
|
2000-08-12 07:25:55 +00:00
|
|
|
gchar *current_directory)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-01-21 07:53:07 +00:00
|
|
|
HistoryCallbackArg *callback_arg;
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
GList *list;
|
|
|
|
gchar *current_dir;
|
|
|
|
gint dir_len;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
|
|
g_return_if_fail (current_directory != NULL);
|
|
|
|
|
|
|
|
list = fs->history_list;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
if (fs->history_menu)
|
|
|
|
{
|
|
|
|
while (list) {
|
|
|
|
callback_arg = list->data;
|
|
|
|
g_free (callback_arg->directory);
|
1998-03-24 05:27:00 +00:00
|
|
|
g_free (callback_arg);
|
1998-01-21 07:53:07 +00:00
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
g_list_free (fs->history_list);
|
|
|
|
fs->history_list = NULL;
|
|
|
|
|
|
|
|
gtk_widget_destroy (fs->history_menu);
|
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
fs->history_menu = gtk_menu_new ();
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-02-03 14:13:05 +00:00
|
|
|
current_dir = g_strdup (current_directory);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
dir_len = strlen (current_dir);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
for (i = dir_len; i >= 0; i--)
|
|
|
|
{
|
1998-03-09 10:54:13 +00:00
|
|
|
/* the i == dir_len is to catch the full path for the first
|
|
|
|
* entry. */
|
1999-03-13 01:14:19 +00:00
|
|
|
if ( (current_dir[i] == G_DIR_SEPARATOR) || (i == dir_len))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-09 10:54:13 +00:00
|
|
|
/* another small hack to catch the full path */
|
|
|
|
if (i != dir_len)
|
|
|
|
current_dir[i + 1] = '\0';
|
1999-10-06 19:47:24 +00:00
|
|
|
#ifdef G_WITH_CYGWIN
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!strcmp (current_dir, "//"))
|
1999-03-13 01:14:19 +00:00
|
|
|
continue;
|
|
|
|
#endif
|
1998-03-09 10:54:13 +00:00
|
|
|
menu_item = gtk_menu_item_new_with_label (current_dir);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
|
|
|
callback_arg = g_new (HistoryCallbackArg, 1);
|
|
|
|
callback_arg->menu_item = menu_item;
|
1998-01-21 08:50:47 +00:00
|
|
|
|
1998-03-09 10:54:13 +00:00
|
|
|
/* since the autocompletion gets confused if you don't
|
|
|
|
* supply a trailing '/' on a dir entry, set the full
|
|
|
|
* (current) path to "" which just refreshes the filesel */
|
2000-02-23 22:55:27 +00:00
|
|
|
if (dir_len == i)
|
|
|
|
{
|
|
|
|
callback_arg->directory = g_strdup ("");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
callback_arg->directory = g_strdup (current_dir);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
fs->history_list = g_list_append (fs->history_list, callback_arg);
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
g_signal_connect (menu_item, "activate",
|
|
|
|
G_CALLBACK (gtk_file_selection_history_callback),
|
|
|
|
fs);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (fs->history_menu), menu_item);
|
1998-01-21 07:53:07 +00:00
|
|
|
gtk_widget_show (menu_item);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
1998-03-09 10:54:13 +00:00
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (fs->history_pulldown),
|
|
|
|
fs->history_menu);
|
|
|
|
g_free (current_dir);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
static gchar *
|
2002-02-17 00:07:48 +00:00
|
|
|
get_real_filename (gchar *filename,
|
|
|
|
gboolean free_old)
|
1998-02-18 10:03:54 +00:00
|
|
|
{
|
1999-10-06 19:47:24 +00:00
|
|
|
#ifdef G_WITH_CYGWIN
|
1999-03-13 01:14:19 +00:00
|
|
|
/* Check to see if the selection was a drive selector */
|
2001-07-12 22:45:05 +00:00
|
|
|
if (isalpha (filename[0]) && (filename[1] == ':'))
|
|
|
|
{
|
2002-08-31 17:33:43 +00:00
|
|
|
gchar temp_filename[MAX_PATH];
|
|
|
|
int len;
|
|
|
|
|
|
|
|
cygwin_conv_to_posix_path (filename, temp_filename);
|
|
|
|
|
|
|
|
/* we need trailing '/'. */
|
|
|
|
len = strlen (temp_filename);
|
|
|
|
if (len > 0 && temp_filename[len-1] != '/')
|
|
|
|
{
|
|
|
|
temp_filename[len] = '/';
|
|
|
|
temp_filename[len+1] = '\0';
|
|
|
|
}
|
|
|
|
|
2002-02-17 00:07:48 +00:00
|
|
|
if (free_old)
|
|
|
|
g_free (filename);
|
|
|
|
|
2002-08-31 17:33:43 +00:00
|
|
|
return g_strdup (temp_filename);
|
2001-07-12 22:45:05 +00:00
|
|
|
}
|
1999-10-06 19:47:24 +00:00
|
|
|
#endif /* G_WITH_CYGWIN */
|
2002-08-31 17:33:43 +00:00
|
|
|
return filename;
|
2002-01-29 20:53:17 +00:00
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
static void
|
|
|
|
gtk_file_selection_file_activate (GtkTreeView *tree_view,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkTreeViewColumn *column,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkFileSelection *fs = GTK_FILE_SELECTION (user_data);
|
|
|
|
GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
gtk_tree_model_get_iter (model, &iter, path);
|
|
|
|
gtk_tree_model_get (model, &iter, FILE_COLUMN, &filename, -1);
|
2002-02-17 00:07:48 +00:00
|
|
|
filename = get_real_filename (filename, TRUE);
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
|
|
|
|
gtk_button_clicked (GTK_BUTTON (fs->ok_button));
|
|
|
|
|
|
|
|
g_free (filename);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
static void
|
|
|
|
gtk_file_selection_dir_activate (GtkTreeView *tree_view,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkTreeViewColumn *column,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkFileSelection *fs = GTK_FILE_SELECTION (user_data);
|
|
|
|
GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gchar *filename;
|
1998-03-11 07:59:46 +00:00
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_tree_model_get_iter (model, &iter, path);
|
|
|
|
gtk_tree_model_get (model, &iter, DIR_COLUMN, &filename, -1);
|
2002-08-31 17:33:43 +00:00
|
|
|
filename = get_real_filename (filename, TRUE);
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_file_selection_populate (fs, filename, FALSE, FALSE);
|
|
|
|
g_free (filename);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifdef G_PLATFORM_WIN32
|
1999-03-13 01:14:19 +00:00
|
|
|
|
|
|
|
static void
|
2002-01-29 20:53:17 +00:00
|
|
|
win32_gtk_add_drives_to_dir_list (GtkListStore *model)
|
1999-03-13 01:14:19 +00:00
|
|
|
{
|
2002-01-29 20:53:17 +00:00
|
|
|
gchar *textPtr;
|
1999-03-13 01:14:19 +00:00
|
|
|
gchar buffer[128];
|
|
|
|
char formatBuffer[128];
|
2002-01-29 20:53:17 +00:00
|
|
|
GtkTreeIter iter;
|
1999-03-13 01:14:19 +00:00
|
|
|
|
2002-02-24 02:09:16 +00:00
|
|
|
/* Get the drives string */
|
2000-08-12 07:25:55 +00:00
|
|
|
GetLogicalDriveStrings (sizeof (buffer), buffer);
|
1999-03-13 01:14:19 +00:00
|
|
|
|
|
|
|
/* Add the drives as necessary */
|
|
|
|
textPtr = buffer;
|
2002-02-24 02:09:16 +00:00
|
|
|
while (*textPtr != '\0')
|
|
|
|
{
|
|
|
|
/* Ignore floppies (?) */
|
2003-02-09 21:51:27 +00:00
|
|
|
if (GetDriveType (textPtr) != DRIVE_REMOVABLE)
|
2002-02-24 02:09:16 +00:00
|
|
|
{
|
|
|
|
/* Build the actual displayable string */
|
2002-12-15 01:49:01 +00:00
|
|
|
g_snprintf (formatBuffer, sizeof (formatBuffer), "%c:\\", toupper (textPtr[0]));
|
2002-02-24 02:09:16 +00:00
|
|
|
|
|
|
|
/* Add to the list */
|
|
|
|
gtk_list_store_append (model, &iter);
|
|
|
|
gtk_list_store_set (model, &iter, DIR_COLUMN, formatBuffer, -1);
|
|
|
|
}
|
|
|
|
textPtr += (strlen (textPtr) + 1);
|
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-11-02 03:54:18 +00:00
|
|
|
static gchar *
|
|
|
|
escape_underscores (const gchar *str)
|
|
|
|
{
|
|
|
|
GString *result = g_string_new (NULL);
|
|
|
|
while (*str)
|
|
|
|
{
|
|
|
|
if (*str == '_')
|
|
|
|
g_string_append_c (result, '_');
|
|
|
|
|
|
|
|
g_string_append_c (result, *str);
|
|
|
|
str++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_string_free (result, FALSE);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_file_selection_populate (GtkFileSelection *fs,
|
|
|
|
gchar *rel_path,
|
2002-01-17 01:37:06 +00:00
|
|
|
gboolean try_complete,
|
|
|
|
gboolean reset_entry)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
CompletionState *cmpl_state;
|
|
|
|
PossibleCompletion* poss;
|
2002-01-29 20:53:17 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkListStore *dir_model;
|
|
|
|
GtkListStore *file_model;
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar* filename;
|
|
|
|
gchar* rem_path = rel_path;
|
|
|
|
gchar* sel_text;
|
|
|
|
gint did_recurse = FALSE;
|
|
|
|
gint possible_count = 0;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
2002-01-29 20:53:17 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_state = (CompletionState*) fs->cmpl_state;
|
|
|
|
poss = cmpl_completion_matches (rel_path, &rem_path, cmpl_state);
|
|
|
|
|
|
|
|
if (!cmpl_state_okay (cmpl_state))
|
|
|
|
{
|
|
|
|
/* Something went wrong. */
|
|
|
|
gtk_file_selection_abort (fs);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (cmpl_state->reference_dir);
|
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
dir_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fs->dir_list)));
|
|
|
|
file_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fs->file_list)));
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_list_store_clear (dir_model);
|
|
|
|
gtk_list_store_clear (file_model);
|
1998-01-21 07:53:07 +00:00
|
|
|
|
2002-01-29 20:53:17 +00:00
|
|
|
/* Set the dir list to include ./ and ../ */
|
|
|
|
gtk_list_store_append (dir_model, &iter);
|
|
|
|
gtk_list_store_set (dir_model, &iter, DIR_COLUMN, "." G_DIR_SEPARATOR_S, -1);
|
|
|
|
gtk_list_store_append (dir_model, &iter);
|
|
|
|
gtk_list_store_set (dir_model, &iter, DIR_COLUMN, ".." G_DIR_SEPARATOR_S, -1);
|
1998-03-13 09:19:03 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (poss)
|
|
|
|
{
|
|
|
|
if (cmpl_is_a_completion (poss))
|
|
|
|
{
|
|
|
|
possible_count += 1;
|
|
|
|
|
1998-03-24 01:43:21 +00:00
|
|
|
filename = cmpl_this_completion (poss);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (cmpl_is_directory (poss))
|
|
|
|
{
|
1999-03-13 01:14:19 +00:00
|
|
|
if (strcmp (filename, "." G_DIR_SEPARATOR_S) != 0 &&
|
|
|
|
strcmp (filename, ".." G_DIR_SEPARATOR_S) != 0)
|
2002-01-29 20:53:17 +00:00
|
|
|
{
|
|
|
|
gtk_list_store_append (dir_model, &iter);
|
|
|
|
gtk_list_store_set (dir_model, &iter, DIR_COLUMN, filename, -1);
|
|
|
|
}
|
1998-01-21 07:53:07 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1998-01-21 07:53:07 +00:00
|
|
|
{
|
2002-01-29 20:53:17 +00:00
|
|
|
gtk_list_store_append (file_model, &iter);
|
|
|
|
gtk_list_store_set (file_model, &iter, DIR_COLUMN, filename, -1);
|
1998-01-21 07:53:07 +00:00
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
poss = cmpl_next_completion (cmpl_state);
|
|
|
|
}
|
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifdef G_PLATFORM_WIN32
|
1999-03-13 01:14:19 +00:00
|
|
|
/* For Windows, add drives as potential selections */
|
2002-01-29 20:53:17 +00:00
|
|
|
win32_gtk_add_drives_to_dir_list (dir_model);
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* File lists are set. */
|
|
|
|
|
|
|
|
g_assert (cmpl_state->reference_dir);
|
|
|
|
|
|
|
|
if (try_complete)
|
|
|
|
{
|
1998-01-21 07:53:07 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* User is trying to complete filenames, so advance the user's input
|
|
|
|
* string to the updated_text, which is the common leading substring
|
|
|
|
* of all possible completions, and if its a directory attempt
|
|
|
|
* attempt completions in it. */
|
|
|
|
|
|
|
|
if (cmpl_updated_text (cmpl_state)[0])
|
|
|
|
{
|
1998-01-21 07:53:07 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (cmpl_updated_dir (cmpl_state))
|
|
|
|
{
|
1998-01-21 07:53:07 +00:00
|
|
|
gchar* dir_name = g_strdup (cmpl_updated_text (cmpl_state));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
did_recurse = TRUE;
|
|
|
|
|
2002-01-17 01:37:06 +00:00
|
|
|
gtk_file_selection_populate (fs, dir_name, TRUE, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_free (dir_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (fs->selection_entry)
|
1998-01-21 07:53:07 +00:00
|
|
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry),
|
|
|
|
cmpl_updated_text (cmpl_state));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (fs->selection_entry)
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), rem_path);
|
|
|
|
}
|
|
|
|
}
|
2002-01-17 01:37:06 +00:00
|
|
|
else if (reset_entry)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
if (fs->selection_entry)
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!did_recurse)
|
|
|
|
{
|
2003-08-14 22:30:28 +00:00
|
|
|
if (fs->selection_entry && try_complete)
|
|
|
|
gtk_editable_set_position (GTK_EDITABLE (fs->selection_entry), -1);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (fs->selection_entry)
|
|
|
|
{
|
2002-11-02 03:54:18 +00:00
|
|
|
char *escaped = escape_underscores (cmpl_reference_position (cmpl_state));
|
|
|
|
sel_text = g_strconcat (_("_Selection: "), escaped, NULL);
|
|
|
|
g_free (escaped);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-11-02 03:54:18 +00:00
|
|
|
gtk_label_set_text_with_mnemonic (GTK_LABEL (fs->selection_text), sel_text);
|
1997-11-24 22:37:52 +00:00
|
|
|
g_free (sel_text);
|
|
|
|
}
|
|
|
|
|
1998-01-21 07:53:07 +00:00
|
|
|
if (fs->history_pulldown)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-01-21 07:53:07 +00:00
|
|
|
gtk_file_selection_update_history_menu (fs, cmpl_reference_position (cmpl_state));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-01-21 07:53:07 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_file_selection_abort (GtkFileSelection *fs)
|
|
|
|
{
|
|
|
|
gchar err_buf[256];
|
|
|
|
|
2002-12-15 01:49:01 +00:00
|
|
|
g_snprintf (err_buf, sizeof (err_buf), _("Folder unreadable: %s"), cmpl_strerror (cmpl_errno));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* BEEP gdk_beep(); */
|
|
|
|
|
|
|
|
if (fs->selection_entry)
|
1998-12-15 20:31:26 +00:00
|
|
|
gtk_label_set_text (GTK_LABEL (fs->selection_text), err_buf);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2002-02-17 00:07:48 +00:00
|
|
|
/**
|
|
|
|
* gtk_file_selection_set_select_multiple:
|
|
|
|
* @filesel: a #GtkFileSelection
|
|
|
|
* @select_multiple: whether or not the user is allowed to select multiple
|
|
|
|
* files in the file list.
|
|
|
|
*
|
|
|
|
* Sets whether the user is allowed to select multiple files in the file list.
|
|
|
|
* Use gtk_file_selection_get_selections () to get the list of selected files.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_file_selection_set_select_multiple (GtkFileSelection *filesel,
|
|
|
|
gboolean select_multiple)
|
|
|
|
{
|
|
|
|
GtkTreeSelection *sel;
|
|
|
|
GtkSelectionMode mode;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
|
|
|
|
|
|
|
|
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (filesel->file_list));
|
|
|
|
|
|
|
|
mode = select_multiple ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE;
|
|
|
|
|
2002-02-18 03:29:00 +00:00
|
|
|
if (mode != gtk_tree_selection_get_mode (sel))
|
|
|
|
{
|
|
|
|
gtk_tree_selection_set_mode (sel, mode);
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (filesel), "select-multiple");
|
|
|
|
}
|
2002-02-17 00:07:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_file_selection_get_select_multiple:
|
|
|
|
* @filesel: a #GtkFileSelection
|
|
|
|
*
|
|
|
|
* Determines whether or not the user is allowed to select multiple files in
|
|
|
|
* the file list. See gtk_file_selection_set_select_multiple().
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the user is allowed to select multiple files in the
|
|
|
|
* file list
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_file_selection_get_select_multiple (GtkFileSelection *filesel)
|
|
|
|
{
|
|
|
|
GtkTreeSelection *sel;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_FILE_SELECTION (filesel), FALSE);
|
|
|
|
|
|
|
|
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (filesel->file_list));
|
|
|
|
return (gtk_tree_selection_get_mode (sel) == GTK_SELECTION_MULTIPLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
multiple_changed_foreach (GtkTreeModel *model,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GPtrArray *names = data;
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, iter, FILE_COLUMN, &filename, -1);
|
|
|
|
|
|
|
|
g_ptr_array_add (names, filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_selected_names (GPtrArray *names)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < names->len; i++)
|
|
|
|
g_free (g_ptr_array_index (names, i));
|
|
|
|
|
|
|
|
g_ptr_array_free (names, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_file_selection_file_changed (GtkTreeSelection *selection,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkFileSelection *fs = GTK_FILE_SELECTION (user_data);
|
|
|
|
GPtrArray *new_names;
|
|
|
|
gchar *filename;
|
|
|
|
const gchar *entry;
|
|
|
|
gint index = -1;
|
|
|
|
|
|
|
|
new_names = g_ptr_array_sized_new (8);
|
|
|
|
|
|
|
|
gtk_tree_selection_selected_foreach (selection,
|
|
|
|
multiple_changed_foreach,
|
|
|
|
new_names);
|
|
|
|
|
|
|
|
/* nothing selected */
|
|
|
|
if (new_names->len == 0)
|
|
|
|
{
|
|
|
|
g_ptr_array_free (new_names, TRUE);
|
|
|
|
|
|
|
|
if (fs->selected_names != NULL)
|
|
|
|
{
|
|
|
|
free_selected_names (fs->selected_names);
|
|
|
|
fs->selected_names = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
goto maybe_clear_entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_names->len != 1)
|
|
|
|
{
|
|
|
|
GPtrArray *old_names = fs->selected_names;
|
|
|
|
|
|
|
|
if (old_names != NULL)
|
|
|
|
{
|
|
|
|
/* A common case is selecting a range of files from top to bottom,
|
|
|
|
* so quickly check for that to avoid looping over the entire list
|
|
|
|
*/
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
if (compare_utf8_filenames (g_ptr_array_index (old_names, old_names->len - 1),
|
|
|
|
g_ptr_array_index (new_names, new_names->len - 1)) != 0)
|
2002-02-17 00:07:48 +00:00
|
|
|
index = new_names->len - 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gint i = 0, j = 0, cmp;
|
|
|
|
|
|
|
|
/* do a quick diff, stopping at the first file not in the
|
|
|
|
* old list
|
|
|
|
*/
|
|
|
|
while (i < old_names->len && j < new_names->len)
|
|
|
|
{
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
cmp = compare_utf8_filenames (g_ptr_array_index (old_names, i),
|
|
|
|
g_ptr_array_index (new_names, j));
|
2002-02-17 00:07:48 +00:00
|
|
|
if (cmp < 0)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
else if (cmp == 0)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
else if (cmp > 0)
|
|
|
|
{
|
|
|
|
index = j;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we ran off the end of the old list */
|
|
|
|
if (index == -1 && i < new_names->len)
|
|
|
|
index = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* A phantom anchor still exists at the point where the last item
|
|
|
|
* was selected, which is used for subsequent range selections.
|
|
|
|
* So search up from there.
|
|
|
|
*/
|
2002-09-25 06:54:58 +00:00
|
|
|
if (fs->last_selected &&
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
compare_utf8_filenames (fs->last_selected,
|
|
|
|
g_ptr_array_index (new_names, 0)) == 0)
|
2002-02-17 00:07:48 +00:00
|
|
|
index = new_names->len - 1;
|
|
|
|
else
|
|
|
|
index = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
if (fs->selected_names != NULL)
|
|
|
|
free_selected_names (fs->selected_names);
|
|
|
|
|
|
|
|
fs->selected_names = new_names;
|
|
|
|
|
|
|
|
if (index != -1)
|
|
|
|
{
|
|
|
|
if (fs->last_selected != NULL)
|
|
|
|
g_free (fs->last_selected);
|
|
|
|
|
|
|
|
fs->last_selected = g_strdup (g_ptr_array_index (new_names, index));
|
|
|
|
filename = get_real_filename (fs->last_selected, FALSE);
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
|
|
|
|
|
|
|
|
if (filename != fs->last_selected)
|
|
|
|
g_free (filename);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
maybe_clear_entry:
|
|
|
|
|
|
|
|
entry = gtk_entry_get_text (GTK_ENTRY (fs->selection_entry));
|
|
|
|
if ((entry != NULL) && (fs->last_selected != NULL) &&
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
(compare_utf8_filenames (entry, fs->last_selected) == 0))
|
2002-02-17 00:07:48 +00:00
|
|
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_file_selection_get_selections:
|
|
|
|
* @filesel: a #GtkFileSelection
|
|
|
|
*
|
|
|
|
* Retrieves the list of file selections the user has made in the dialog box.
|
|
|
|
* This function is intended for use when the user can select multiple files
|
2004-11-15 13:48:52 +00:00
|
|
|
* in the file list.
|
2002-02-17 00:07:48 +00:00
|
|
|
*
|
2004-12-12 21:09:13 +00:00
|
|
|
* The filenames are in the GLib file name encoding. To convert to
|
|
|
|
* UTF-8, call g_filename_to_utf8() on each string.
|
2002-02-17 00:07:48 +00:00
|
|
|
*
|
|
|
|
* Return value: a newly-allocated %NULL-terminated array of strings. Use
|
|
|
|
* g_strfreev() to free it.
|
|
|
|
**/
|
|
|
|
gchar **
|
|
|
|
gtk_file_selection_get_selections (GtkFileSelection *filesel)
|
|
|
|
{
|
|
|
|
GPtrArray *names;
|
|
|
|
gchar **selections;
|
|
|
|
gchar *filename, *dirname;
|
|
|
|
gchar *current, *buf;
|
|
|
|
gint i, count;
|
2002-09-25 06:34:33 +00:00
|
|
|
gboolean unselected_entry;
|
2002-02-17 00:07:48 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_FILE_SELECTION (filesel), NULL);
|
|
|
|
|
|
|
|
filename = g_strdup (gtk_file_selection_get_filename (filesel));
|
|
|
|
|
|
|
|
if (strlen (filename) == 0)
|
|
|
|
{
|
|
|
|
g_free (filename);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-02-24 02:09:16 +00:00
|
|
|
names = filesel->selected_names;
|
|
|
|
|
|
|
|
if (names != NULL)
|
|
|
|
selections = g_new (gchar *, names->len + 2);
|
|
|
|
else
|
|
|
|
selections = g_new (gchar *, 2);
|
|
|
|
|
2002-02-17 00:07:48 +00:00
|
|
|
count = 0;
|
2002-09-25 06:34:33 +00:00
|
|
|
unselected_entry = TRUE;
|
2002-02-17 00:07:48 +00:00
|
|
|
|
|
|
|
if (names != NULL)
|
|
|
|
{
|
|
|
|
dirname = g_path_get_dirname (filename);
|
|
|
|
|
2004-11-15 13:48:52 +00:00
|
|
|
if ((names->len >= 1) &&
|
|
|
|
(strcmp (gtk_entry_get_text (GTK_ENTRY (filesel->selection_entry)), "") == 0))
|
|
|
|
{ /* multiple files are selected and last selection was removed via ctrl click */
|
|
|
|
g_free (dirname);
|
|
|
|
dirname = g_strdup (filename); /* as gtk_file_selection_get_filename returns dir
|
|
|
|
if no file is selected */
|
|
|
|
unselected_entry = FALSE;
|
|
|
|
}
|
|
|
|
|
2002-02-17 00:07:48 +00:00
|
|
|
for (i = 0; i < names->len; i++)
|
|
|
|
{
|
|
|
|
buf = g_filename_from_utf8 (g_ptr_array_index (names, i), -1,
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
current = g_build_filename (dirname, buf, NULL);
|
|
|
|
g_free (buf);
|
|
|
|
|
2002-09-25 06:34:33 +00:00
|
|
|
selections[count++] = current;
|
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
if (unselected_entry && compare_sys_filenames (current, filename) == 0)
|
2002-09-25 06:34:33 +00:00
|
|
|
unselected_entry = FALSE;
|
2002-02-17 00:07:48 +00:00
|
|
|
}
|
2002-03-04 16:04:31 +00:00
|
|
|
|
|
|
|
g_free (dirname);
|
2002-02-17 00:07:48 +00:00
|
|
|
}
|
|
|
|
|
2002-09-25 06:34:33 +00:00
|
|
|
if (unselected_entry)
|
|
|
|
selections[count++] = filename;
|
|
|
|
else
|
|
|
|
g_free (filename);
|
|
|
|
|
2002-02-17 00:07:48 +00:00
|
|
|
selections[count] = NULL;
|
|
|
|
|
|
|
|
return selections;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
/* External Interface */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
/* The four completion state selectors
|
|
|
|
*/
|
|
|
|
static gchar*
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_updated_text (CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
return cmpl_state->updated_text;
|
|
|
|
}
|
|
|
|
|
2000-02-03 01:19:03 +00:00
|
|
|
static gboolean
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_updated_dir (CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
return cmpl_state->re_complete;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar*
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_reference_position (CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
return cmpl_state->reference_dir->fullname;
|
|
|
|
}
|
|
|
|
|
2003-08-14 22:30:28 +00:00
|
|
|
#if 0
|
|
|
|
/* This doesn't work currently and would require changes
|
|
|
|
* to fnmatch.c to get working.
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_last_valid_char (CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
return cmpl_state->last_valid_char;
|
|
|
|
}
|
2003-08-14 22:30:28 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-08-01 21:20:21 +00:00
|
|
|
static gchar*
|
2001-10-23 16:02:23 +00:00
|
|
|
cmpl_completion_fullname (const gchar *text,
|
2000-08-12 07:25:55 +00:00
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-05-01 04:23:59 +00:00
|
|
|
if (!cmpl_state_okay (cmpl_state))
|
|
|
|
{
|
2003-08-01 21:20:21 +00:00
|
|
|
return g_strdup ("");
|
1998-05-01 04:23:59 +00:00
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
else if (g_path_is_absolute (text))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2003-08-01 21:20:21 +00:00
|
|
|
return g_strdup (text);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (text[0] == '~')
|
|
|
|
{
|
|
|
|
CompletionDir* dir;
|
|
|
|
char* slash;
|
|
|
|
|
|
|
|
dir = open_user_dir (text, cmpl_state);
|
|
|
|
|
2003-08-01 21:20:21 +00:00
|
|
|
if (dir)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-03-13 01:14:19 +00:00
|
|
|
slash = strchr (text, G_DIR_SEPARATOR);
|
2003-08-01 21:20:21 +00:00
|
|
|
|
|
|
|
/* slash may be NULL, that works too */
|
|
|
|
return g_strconcat (dir->fullname, slash, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
2003-08-01 21:20:21 +00:00
|
|
|
|
|
|
|
return g_build_filename (cmpl_state->reference_dir->fullname,
|
|
|
|
text,
|
|
|
|
NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The three completion selectors
|
|
|
|
*/
|
|
|
|
static gchar*
|
|
|
|
cmpl_this_completion (PossibleCompletion* pc)
|
|
|
|
{
|
|
|
|
return pc->text;
|
|
|
|
}
|
|
|
|
|
2000-02-03 01:19:03 +00:00
|
|
|
static gboolean
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_is_directory (PossibleCompletion* pc)
|
|
|
|
{
|
|
|
|
return pc->is_directory;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
cmpl_is_a_completion (PossibleCompletion* pc)
|
|
|
|
{
|
|
|
|
return pc->is_a_completion;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Construction, deletion */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
2003-08-14 22:00:27 +00:00
|
|
|
/* Get the nearest parent of the current directory for which
|
|
|
|
* we can convert the filename into UTF-8. With paranoia.
|
|
|
|
* Returns "." when all goes wrong.
|
|
|
|
*/
|
|
|
|
static gchar *
|
|
|
|
get_current_dir_utf8 (void)
|
|
|
|
{
|
|
|
|
gchar *dir = g_get_current_dir ();
|
|
|
|
gchar *dir_utf8 = NULL;
|
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
gchar *last_slash;
|
|
|
|
|
|
|
|
dir_utf8 = g_filename_to_utf8 (dir, -1, NULL, NULL, NULL);
|
|
|
|
if (dir_utf8)
|
|
|
|
break;
|
|
|
|
|
|
|
|
last_slash = strrchr (dir, G_DIR_SEPARATOR);
|
|
|
|
if (!last_slash) /* g_get_current_dir() wasn't absolute! */
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (last_slash + 1 == g_path_skip_root (dir)) /* Parent directory is a root directory */
|
|
|
|
{
|
|
|
|
if (last_slash[1] == '\0') /* Root misencoded! */
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
last_slash[1] = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
last_slash[0] = '\0';
|
|
|
|
|
|
|
|
g_assert (last_slash);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (dir);
|
|
|
|
|
|
|
|
return dir_utf8 ? dir_utf8 : g_strdup (".");
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static CompletionState*
|
|
|
|
cmpl_init_state (void)
|
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
gchar *utf8_cwd;
|
1997-11-24 22:37:52 +00:00
|
|
|
CompletionState *new_state;
|
2005-07-01 15:51:30 +00:00
|
|
|
gint tries = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
new_state = g_new (CompletionState, 1);
|
|
|
|
|
2003-08-14 22:00:27 +00:00
|
|
|
utf8_cwd = get_current_dir_utf8 ();
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-05-01 04:23:59 +00:00
|
|
|
tryagain:
|
2005-07-01 15:51:30 +00:00
|
|
|
tries++;
|
1997-11-24 22:37:52 +00:00
|
|
|
new_state->reference_dir = NULL;
|
|
|
|
new_state->completion_dir = NULL;
|
|
|
|
new_state->active_completion_dir = NULL;
|
|
|
|
new_state->directory_storage = NULL;
|
|
|
|
new_state->directory_sent_storage = NULL;
|
|
|
|
new_state->last_valid_char = 0;
|
|
|
|
new_state->updated_text = g_new (gchar, MAXPATHLEN);
|
|
|
|
new_state->updated_text_alloc = MAXPATHLEN;
|
|
|
|
new_state->the_completion.text = g_new (gchar, MAXPATHLEN);
|
|
|
|
new_state->the_completion.text_alloc = MAXPATHLEN;
|
|
|
|
new_state->user_dir_name_buffer = NULL;
|
|
|
|
new_state->user_directories = NULL;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
new_state->reference_dir = open_dir (utf8_cwd, new_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (!new_state->reference_dir)
|
1998-05-01 04:23:59 +00:00
|
|
|
{
|
|
|
|
/* Directories changing from underneath us, grumble */
|
2000-08-12 07:45:56 +00:00
|
|
|
strcpy (utf8_cwd, G_DIR_SEPARATOR_S);
|
2005-07-01 15:51:30 +00:00
|
|
|
if (tries < 2)
|
|
|
|
goto tryagain;
|
1998-05-01 04:23:59 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
g_free (utf8_cwd);
|
1997-11-24 22:37:52 +00:00
|
|
|
return new_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_free_dir_list (GList* dp0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GList *dp = dp0;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
while (dp)
|
|
|
|
{
|
|
|
|
free_dir (dp->data);
|
|
|
|
dp = dp->next;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
g_list_free (dp0);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_free_dir_sent_list (GList* dp0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GList *dp = dp0;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
while (dp)
|
|
|
|
{
|
|
|
|
free_dir_sent (dp->data);
|
|
|
|
dp = dp->next;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
g_list_free (dp0);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cmpl_free_state (CompletionState* cmpl_state)
|
|
|
|
{
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
g_return_if_fail (cmpl_state != NULL);
|
|
|
|
|
1998-02-02 18:44:28 +00:00
|
|
|
cmpl_free_dir_list (cmpl_state->directory_storage);
|
|
|
|
cmpl_free_dir_sent_list (cmpl_state->directory_sent_storage);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (cmpl_state->user_dir_name_buffer)
|
|
|
|
g_free (cmpl_state->user_dir_name_buffer);
|
|
|
|
if (cmpl_state->user_directories)
|
|
|
|
g_free (cmpl_state->user_directories);
|
|
|
|
if (cmpl_state->the_completion.text)
|
|
|
|
g_free (cmpl_state->the_completion.text);
|
|
|
|
if (cmpl_state->updated_text)
|
|
|
|
g_free (cmpl_state->updated_text);
|
|
|
|
|
|
|
|
g_free (cmpl_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
free_dir (CompletionDir* dir)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2002-02-10 13:18:51 +00:00
|
|
|
g_free (dir->cmpl_text);
|
2000-08-12 07:25:55 +00:00
|
|
|
g_free (dir->fullname);
|
|
|
|
g_free (dir);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
free_dir_sent (CompletionDirSent* sent)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-02-03 01:19:03 +00:00
|
|
|
gint i;
|
|
|
|
for (i = 0; i < sent->entry_count; i++)
|
2002-12-13 23:28:56 +00:00
|
|
|
{
|
|
|
|
g_free (sent->entries[i].entry_name);
|
|
|
|
g_free (sent->entries[i].sort_key);
|
|
|
|
}
|
2000-08-12 07:25:55 +00:00
|
|
|
g_free (sent->entries);
|
|
|
|
g_free (sent);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
prune_memory_usage (CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GList* cdsl = cmpl_state->directory_sent_storage;
|
|
|
|
GList* cdl = cmpl_state->directory_storage;
|
|
|
|
GList* cdl0 = cdl;
|
|
|
|
gint len = 0;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
for (; cdsl && len < CMPL_DIRECTORY_CACHE_SIZE; len += 1)
|
1997-11-24 22:37:52 +00:00
|
|
|
cdsl = cdsl->next;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cdsl)
|
|
|
|
{
|
|
|
|
cmpl_free_dir_sent_list (cdsl->next);
|
|
|
|
cdsl->next = NULL;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1997-12-07 02:34:38 +00:00
|
|
|
cmpl_state->directory_storage = NULL;
|
2000-08-12 07:25:55 +00:00
|
|
|
while (cdl)
|
|
|
|
{
|
|
|
|
if (cdl->data == cmpl_state->reference_dir)
|
|
|
|
cmpl_state->directory_storage = g_list_prepend (NULL, cdl->data);
|
|
|
|
else
|
|
|
|
free_dir (cdl->data);
|
|
|
|
cdl = cdl->next;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
g_list_free (cdl0);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* The main entrances. */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
static PossibleCompletion*
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_completion_matches (gchar *text_to_complete,
|
|
|
|
gchar **remaining_text,
|
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar* first_slash;
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
PossibleCompletion *poss;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
prune_memory_usage (cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-10-22 00:54:57 +00:00
|
|
|
g_assert (text_to_complete != NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->user_completion_index = -1;
|
|
|
|
cmpl_state->last_completion_text = text_to_complete;
|
|
|
|
cmpl_state->the_completion.text[0] = 0;
|
|
|
|
cmpl_state->last_valid_char = 0;
|
|
|
|
cmpl_state->updated_text_len = -1;
|
|
|
|
cmpl_state->updated_text[0] = 0;
|
|
|
|
cmpl_state->re_complete = FALSE;
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
|
|
|
first_slash = strchr (text_to_complete, G_DIR_SEPARATOR);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-10-22 00:54:57 +00:00
|
|
|
if (text_to_complete[0] == '~' && !first_slash)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
/* Text starts with ~ and there is no slash, show all the
|
|
|
|
* home directory completions.
|
|
|
|
*/
|
1998-10-22 00:54:57 +00:00
|
|
|
poss = attempt_homedir_completion (text_to_complete, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
update_cmpl (poss, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return poss;
|
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_state->reference_dir =
|
1998-10-22 00:54:57 +00:00
|
|
|
open_ref_dir (text_to_complete, remaining_text, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!cmpl_state->reference_dir)
|
1997-11-24 22:37:52 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
cmpl_state->completion_dir =
|
1998-10-22 00:54:57 +00:00
|
|
|
find_completion_dir (*remaining_text, remaining_text, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->last_valid_char = *remaining_text - text_to_complete;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!cmpl_state->completion_dir)
|
1997-11-24 22:37:52 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
cmpl_state->completion_dir->cmpl_index = -1;
|
|
|
|
cmpl_state->completion_dir->cmpl_parent = NULL;
|
2002-02-10 13:18:51 +00:00
|
|
|
cmpl_state->completion_dir->cmpl_text = g_strdup (*remaining_text);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->active_completion_dir = cmpl_state->completion_dir;
|
|
|
|
|
|
|
|
cmpl_state->reference_dir = cmpl_state->completion_dir;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
poss = attempt_file_completion (cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
update_cmpl (poss, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return poss;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PossibleCompletion*
|
|
|
|
cmpl_next_completion (CompletionState* cmpl_state)
|
|
|
|
{
|
|
|
|
PossibleCompletion* poss = NULL;
|
|
|
|
|
|
|
|
cmpl_state->the_completion.text[0] = 0;
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cmpl_state->user_completion_index >= 0)
|
|
|
|
poss = attempt_homedir_completion (cmpl_state->last_completion_text, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
2000-08-12 07:25:55 +00:00
|
|
|
poss = attempt_file_completion (cmpl_state);
|
1999-03-13 01:14:19 +00:00
|
|
|
#else
|
2000-08-12 07:25:55 +00:00
|
|
|
poss = attempt_file_completion (cmpl_state);
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
update_cmpl (poss, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return poss;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Directory Operations */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
/* Open the directory where completion will begin from, if possible. */
|
|
|
|
static CompletionDir*
|
2000-08-12 07:25:55 +00:00
|
|
|
open_ref_dir (gchar *text_to_complete,
|
|
|
|
gchar **remaining_text,
|
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gchar* first_slash;
|
|
|
|
CompletionDir *new_dir;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
first_slash = strchr (text_to_complete, G_DIR_SEPARATOR);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1999-10-06 19:47:24 +00:00
|
|
|
#ifdef G_WITH_CYGWIN
|
1999-03-13 01:14:19 +00:00
|
|
|
if (text_to_complete[0] == '/' && text_to_complete[1] == '/')
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-03-13 01:14:19 +00:00
|
|
|
char root_dir[5];
|
2002-12-15 01:49:01 +00:00
|
|
|
g_snprintf (root_dir, sizeof (root_dir), "//%c", text_to_complete[2]);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
new_dir = open_dir (root_dir, cmpl_state);
|
1999-03-13 01:14:19 +00:00
|
|
|
|
|
|
|
if (new_dir) {
|
|
|
|
*remaining_text = text_to_complete + 4;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
#else
|
|
|
|
if (FALSE)
|
|
|
|
;
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PWD_H
|
1997-11-24 22:37:52 +00:00
|
|
|
else if (text_to_complete[0] == '~')
|
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
new_dir = open_user_dir (text_to_complete, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (new_dir)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
if (first_slash)
|
1997-11-24 22:37:52 +00:00
|
|
|
*remaining_text = first_slash + 1;
|
|
|
|
else
|
2000-08-12 07:25:55 +00:00
|
|
|
*remaining_text = text_to_complete + strlen (text_to_complete);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
2000-03-14 19:57:25 +00:00
|
|
|
else if (g_path_is_absolute (text_to_complete) || !cmpl_state->reference_dir)
|
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
gchar *tmp = g_strdup (text_to_complete);
|
2000-03-14 19:57:25 +00:00
|
|
|
gchar *p;
|
|
|
|
|
|
|
|
p = tmp;
|
|
|
|
while (*p && *p != '*' && *p != '?')
|
|
|
|
p++;
|
|
|
|
|
|
|
|
*p = '\0';
|
2000-08-12 07:25:55 +00:00
|
|
|
p = strrchr (tmp, G_DIR_SEPARATOR);
|
2000-03-14 19:57:25 +00:00
|
|
|
if (p)
|
|
|
|
{
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
if (p + 1 == g_path_skip_root (tmp))
|
2000-03-14 19:57:25 +00:00
|
|
|
p++;
|
|
|
|
|
|
|
|
*p = '\0';
|
2000-08-12 07:25:55 +00:00
|
|
|
new_dir = open_dir (tmp, cmpl_state);
|
2000-03-14 19:57:25 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (new_dir)
|
2000-03-14 19:57:25 +00:00
|
|
|
*remaining_text = text_to_complete +
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
((p == g_path_skip_root (tmp)) ? (p - tmp) : (p + 1 - tmp));
|
2000-03-14 19:57:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If no possible candidates, use the cwd */
|
2003-08-14 22:00:27 +00:00
|
|
|
gchar *utf8_curdir = get_current_dir_utf8 ();
|
2000-08-12 07:25:55 +00:00
|
|
|
|
|
|
|
new_dir = open_dir (utf8_curdir, cmpl_state);
|
2000-03-14 19:57:25 +00:00
|
|
|
|
|
|
|
if (new_dir)
|
|
|
|
*remaining_text = text_to_complete;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
g_free (utf8_curdir);
|
2000-03-14 19:57:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (tmp);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
*remaining_text = text_to_complete;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
new_dir = open_dir (cmpl_state->reference_dir->fullname, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (new_dir)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
new_dir->cmpl_index = -1;
|
|
|
|
new_dir->cmpl_parent = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new_dir;
|
|
|
|
}
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* open a directory by user name */
|
|
|
|
static CompletionDir*
|
2001-10-23 16:02:23 +00:00
|
|
|
open_user_dir (const gchar *text_to_complete,
|
2000-08-12 07:25:55 +00:00
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
CompletionDir *result;
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar *first_slash;
|
|
|
|
gint cmp_len;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
g_assert (text_to_complete && text_to_complete[0] == '~');
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
first_slash = strchr (text_to_complete, G_DIR_SEPARATOR);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (first_slash)
|
|
|
|
cmp_len = first_slash - text_to_complete - 1;
|
|
|
|
else
|
2000-08-12 07:25:55 +00:00
|
|
|
cmp_len = strlen (text_to_complete + 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!cmp_len)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
/* ~/ */
|
2001-10-23 16:02:23 +00:00
|
|
|
const gchar *homedir = g_get_home_dir ();
|
2001-01-05 21:23:53 +00:00
|
|
|
gchar *utf8_homedir = g_filename_to_utf8 (homedir, -1, NULL, NULL, NULL);
|
2000-08-12 07:25:55 +00:00
|
|
|
|
|
|
|
if (utf8_homedir)
|
|
|
|
result = open_dir (utf8_homedir, cmpl_state);
|
1999-01-28 01:04:38 +00:00
|
|
|
else
|
2000-08-12 07:25:55 +00:00
|
|
|
result = NULL;
|
|
|
|
|
|
|
|
g_free (utf8_homedir);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* ~user/ */
|
2000-08-12 07:25:55 +00:00
|
|
|
gchar* copy = g_new (char, cmp_len + 1);
|
|
|
|
gchar *utf8_dir;
|
1997-11-24 22:37:52 +00:00
|
|
|
struct passwd *pwd;
|
2000-08-12 07:25:55 +00:00
|
|
|
|
|
|
|
strncpy (copy, text_to_complete + 1, cmp_len);
|
1997-11-24 22:37:52 +00:00
|
|
|
copy[cmp_len] = 0;
|
2000-08-12 07:25:55 +00:00
|
|
|
pwd = getpwnam (copy);
|
|
|
|
g_free (copy);
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!pwd)
|
|
|
|
{
|
|
|
|
cmpl_errno = errno;
|
|
|
|
return NULL;
|
|
|
|
}
|
2001-01-05 21:23:53 +00:00
|
|
|
utf8_dir = g_filename_to_utf8 (pwd->pw_dir, -1, NULL, NULL, NULL);
|
2000-08-12 07:25:55 +00:00
|
|
|
result = open_dir (utf8_dir, cmpl_state);
|
|
|
|
g_free (utf8_dir);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
2000-08-12 07:25:55 +00:00
|
|
|
return result;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
|
|
|
|
2005-02-01 18:15:09 +00:00
|
|
|
/* open a directory relative to the current relative directory */
|
1997-11-24 22:37:52 +00:00
|
|
|
static CompletionDir*
|
2000-08-12 07:25:55 +00:00
|
|
|
open_relative_dir (gchar *dir_name,
|
|
|
|
CompletionDir *dir,
|
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-02-03 01:19:03 +00:00
|
|
|
CompletionDir *result;
|
|
|
|
GString *path;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-02-03 01:19:03 +00:00
|
|
|
path = g_string_sized_new (dir->fullname_len + strlen (dir_name) + 10);
|
|
|
|
g_string_assign (path, dir->fullname);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (dir->fullname_len > 1
|
|
|
|
&& path->str[dir->fullname_len - 1] != G_DIR_SEPARATOR)
|
|
|
|
g_string_append_c (path, G_DIR_SEPARATOR);
|
2000-02-03 01:19:03 +00:00
|
|
|
g_string_append (path, dir_name);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
result = open_dir (path->str, cmpl_state);
|
2000-02-03 01:19:03 +00:00
|
|
|
|
|
|
|
g_string_free (path, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-02-03 01:19:03 +00:00
|
|
|
return result;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* after the cache lookup fails, really open a new directory */
|
|
|
|
static CompletionDirSent*
|
2000-08-12 07:25:55 +00:00
|
|
|
open_new_dir (gchar *dir_name,
|
|
|
|
struct stat *sbuf,
|
|
|
|
gboolean stat_subdirs)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
CompletionDirSent *sent;
|
2001-11-18 15:37:13 +00:00
|
|
|
GDir *directory;
|
2001-11-21 17:04:35 +00:00
|
|
|
const char *dirent;
|
2002-04-09 12:05:37 +00:00
|
|
|
GError *error = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint entry_count = 0;
|
2001-03-12 15:39:19 +00:00
|
|
|
gint n_entries = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint i;
|
|
|
|
struct stat ent_sbuf;
|
2000-02-03 01:19:03 +00:00
|
|
|
GString *path;
|
2000-08-12 07:37:27 +00:00
|
|
|
gchar *sys_dir_name;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
sent = g_new (CompletionDirSent, 1);
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
1997-11-24 22:37:52 +00:00
|
|
|
sent->mtime = sbuf->st_mtime;
|
|
|
|
sent->inode = sbuf->st_ino;
|
1998-04-07 23:59:25 +00:00
|
|
|
sent->device = sbuf->st_dev;
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#endif
|
2000-02-03 01:19:03 +00:00
|
|
|
path = g_string_sized_new (2*MAXPATHLEN + 10);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-01-05 21:23:53 +00:00
|
|
|
sys_dir_name = g_filename_from_utf8 (dir_name, -1, NULL, NULL, NULL);
|
2001-03-12 15:39:19 +00:00
|
|
|
if (!sys_dir_name)
|
|
|
|
{
|
|
|
|
cmpl_errno = CMPL_ERRNO_DID_NOT_CONVERT;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
directory = g_dir_open (sys_dir_name, 0, &error);
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!directory)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2001-11-18 15:37:13 +00:00
|
|
|
cmpl_errno = error->code; /* ??? */
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_dir_name);
|
1997-11-24 22:37:52 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
while ((dirent = g_dir_read_name (directory)) != NULL)
|
2000-08-12 07:25:55 +00:00
|
|
|
entry_count++;
|
2002-12-13 01:06:55 +00:00
|
|
|
entry_count += 2; /* For ".",".." */
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
sent->entries = g_new (CompletionDirEntry, entry_count);
|
1997-11-24 22:37:52 +00:00
|
|
|
sent->entry_count = entry_count;
|
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
g_dir_rewind (directory);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
for (i = 0; i < entry_count; i += 1)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2002-03-28 20:08:25 +00:00
|
|
|
GError *error = NULL;
|
|
|
|
|
2002-12-13 01:06:55 +00:00
|
|
|
if (i == 0)
|
|
|
|
dirent = ".";
|
|
|
|
else if (i == 1)
|
|
|
|
dirent = "..";
|
|
|
|
else
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2002-12-13 01:06:55 +00:00
|
|
|
dirent = g_dir_read_name (directory);
|
|
|
|
if (!dirent) /* Directory changed */
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2002-03-28 20:08:25 +00:00
|
|
|
sent->entries[n_entries].entry_name = g_filename_to_utf8 (dirent, -1, NULL, NULL, &error);
|
2002-02-28 23:46:18 +00:00
|
|
|
if (sent->entries[n_entries].entry_name == NULL
|
|
|
|
|| !g_utf8_validate (sent->entries[n_entries].entry_name, -1, NULL))
|
2001-03-12 15:39:19 +00:00
|
|
|
{
|
2002-11-07 23:20:32 +00:00
|
|
|
gchar *escaped_str = g_strescape (dirent, NULL);
|
2004-04-15 20:29:05 +00:00
|
|
|
g_message (_("The filename \"%s\" couldn't be converted to UTF-8. "
|
|
|
|
"(try setting the environment variable G_FILENAME_ENCODING): %s"),
|
2002-11-07 23:20:32 +00:00
|
|
|
escaped_str,
|
2003-04-22 19:36:28 +00:00
|
|
|
error->message ? error->message : _("Invalid UTF-8"));
|
2002-11-07 23:20:32 +00:00
|
|
|
g_free (escaped_str);
|
2002-03-28 20:08:25 +00:00
|
|
|
g_clear_error (&error);
|
2001-03-12 15:39:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
2002-03-28 20:08:25 +00:00
|
|
|
g_clear_error (&error);
|
|
|
|
|
2002-12-13 23:28:56 +00:00
|
|
|
sent->entries[n_entries].sort_key = g_utf8_collate_key (sent->entries[n_entries].entry_name, -1);
|
|
|
|
|
2000-08-12 07:37:27 +00:00
|
|
|
g_string_assign (path, sys_dir_name);
|
2000-02-03 01:19:03 +00:00
|
|
|
if (path->str[path->len-1] != G_DIR_SEPARATOR)
|
1999-03-13 01:14:19 +00:00
|
|
|
{
|
2000-02-03 01:19:03 +00:00
|
|
|
g_string_append_c (path, G_DIR_SEPARATOR);
|
1999-03-13 01:14:19 +00:00
|
|
|
}
|
2001-11-18 15:37:13 +00:00
|
|
|
g_string_append (path, dirent);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-09-12 14:41:04 +00:00
|
|
|
if (stat_subdirs)
|
|
|
|
{
|
2000-08-12 07:45:56 +00:00
|
|
|
/* Here we know path->str is a "system charset" string */
|
2004-12-12 21:09:13 +00:00
|
|
|
if (g_stat (path->str, &ent_sbuf) >= 0 && S_ISDIR (ent_sbuf.st_mode))
|
2001-03-12 15:39:19 +00:00
|
|
|
sent->entries[n_entries].is_dir = TRUE;
|
1998-09-12 14:41:04 +00:00
|
|
|
else
|
|
|
|
/* stat may fail, and we don't mind, since it could be a
|
|
|
|
* dangling symlink. */
|
2001-03-12 15:39:19 +00:00
|
|
|
sent->entries[n_entries].is_dir = FALSE;
|
1998-09-12 14:41:04 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
2001-03-12 15:39:19 +00:00
|
|
|
sent->entries[n_entries].is_dir = 1;
|
2001-03-31 19:33:49 +00:00
|
|
|
|
|
|
|
n_entries++;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
2001-03-12 15:39:19 +00:00
|
|
|
sent->entry_count = n_entries;
|
|
|
|
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_dir_name);
|
2000-02-03 01:19:03 +00:00
|
|
|
g_string_free (path, TRUE);
|
2000-08-12 07:25:55 +00:00
|
|
|
qsort (sent->entries, sent->entry_count, sizeof (CompletionDirEntry), compare_cmpl_dir);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-11-18 15:37:13 +00:00
|
|
|
g_dir_close (directory);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return sent;
|
|
|
|
}
|
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
1999-03-13 01:14:19 +00:00
|
|
|
|
1998-09-12 14:41:04 +00:00
|
|
|
static gboolean
|
2000-08-12 07:25:55 +00:00
|
|
|
check_dir (gchar *dir_name,
|
|
|
|
struct stat *result,
|
|
|
|
gboolean *stat_subdirs)
|
1998-09-12 14:41:04 +00:00
|
|
|
{
|
|
|
|
/* A list of directories that we know only contain other directories.
|
|
|
|
* Trying to stat every file in these directories would be very
|
|
|
|
* expensive.
|
|
|
|
*/
|
|
|
|
|
reverted marius change to expose the type systems internal type info data
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapped accessors, ala gtk_signal_query().
* gtk/gtksignal.c (gtk_signal_connect_by_type): reverted marius change,
since it destroys the possibility to implement automatic marshaller
lookups some day, and it also disables third party code's ability to
connect to any signal. also the GtkTypeInfo structures are dynamically
allocated memory portions, so only the type system is really allowed
to access that stuff.
Mon Dec 7 01:32:18 1998 Tim Janik <timj@gtk.org>
* gtk/gtkfilesel.c (gtk_file_selection_key_press): always intercept the
Tab key on the entry. the focus shouldn't get lost even if completion
is attempted from an empty entry, since an empty entry string does
indeed have a valid completion meaning (complete all).
(gtk_file_selection_init): cast the gchar array parameter in calls to
gtk_clist_new_with_titles() to quit compiler warnings.
(check_dir): the no_stat_dirs struct must not be const, since we do
indeed modify its contents.
* gtk/testgtk.c (event_watcher): adapted prototype to fit new emission
hook semantics.
* gtk/gtksignal.h:
* gtk/gtksignal.c:
changed emission allocation, so we don't use a doubly linked list
but link ourselfs (singly linked).
changed emission hooks, they get the emision parameters passed as
well now and are emitted during the actuall signal emission (after
the RUN_FIRST class method, but prior to RUN_FIRST handlers).
the existing restrictions do still apply to signal emission hooks,
i.e. an emission may not be stopped or restarted from an emission hook.
due to possibly huge perfomance impacts, frequent use of emision hooks
is also not recommended.
(gtk_signal_next_and_invalidate): added an
assertments which explicits what the code assumes anyways: a
maximum amount of 65535 signals.
* gtk/gtkcontainer.h: deprecated gtk_container_foreach_interp(),
gtk_container_foreach_full() should be used instead.
* gtk/gtkmain.h:
deprecated gtk_timeout_add_interp and gtk_idle_add_interp, since
we provide _full variants.
* gtk/gtksignal.h: deprecated gtk_signal_connect_interp(), we provide
gtk_signal_connect_full() for long enough now.
1998-12-07 02:31:19 +00:00
|
|
|
static struct {
|
2005-03-01 06:25:55 +00:00
|
|
|
const gchar *name;
|
1998-09-12 14:41:04 +00:00
|
|
|
gboolean present;
|
|
|
|
struct stat statbuf;
|
|
|
|
} no_stat_dirs[] = {
|
|
|
|
{ "/afs", FALSE, { 0 } },
|
1998-11-30 19:07:15 +00:00
|
|
|
{ "/net", FALSE, { 0 } }
|
1998-09-12 14:41:04 +00:00
|
|
|
};
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
static const gint n_no_stat_dirs = G_N_ELEMENTS (no_stat_dirs);
|
1998-09-12 14:41:04 +00:00
|
|
|
static gboolean initialized = FALSE;
|
2000-08-12 07:37:27 +00:00
|
|
|
gchar *sys_dir_name;
|
1998-09-12 14:41:04 +00:00
|
|
|
gint i;
|
|
|
|
|
|
|
|
if (!initialized)
|
|
|
|
{
|
|
|
|
initialized = TRUE;
|
reverted marius change to expose the type systems internal type info data
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapped accessors, ala gtk_signal_query().
* gtk/gtksignal.c (gtk_signal_connect_by_type): reverted marius change,
since it destroys the possibility to implement automatic marshaller
lookups some day, and it also disables third party code's ability to
connect to any signal. also the GtkTypeInfo structures are dynamically
allocated memory portions, so only the type system is really allowed
to access that stuff.
Mon Dec 7 01:32:18 1998 Tim Janik <timj@gtk.org>
* gtk/gtkfilesel.c (gtk_file_selection_key_press): always intercept the
Tab key on the entry. the focus shouldn't get lost even if completion
is attempted from an empty entry, since an empty entry string does
indeed have a valid completion meaning (complete all).
(gtk_file_selection_init): cast the gchar array parameter in calls to
gtk_clist_new_with_titles() to quit compiler warnings.
(check_dir): the no_stat_dirs struct must not be const, since we do
indeed modify its contents.
* gtk/testgtk.c (event_watcher): adapted prototype to fit new emission
hook semantics.
* gtk/gtksignal.h:
* gtk/gtksignal.c:
changed emission allocation, so we don't use a doubly linked list
but link ourselfs (singly linked).
changed emission hooks, they get the emision parameters passed as
well now and are emitted during the actuall signal emission (after
the RUN_FIRST class method, but prior to RUN_FIRST handlers).
the existing restrictions do still apply to signal emission hooks,
i.e. an emission may not be stopped or restarted from an emission hook.
due to possibly huge perfomance impacts, frequent use of emision hooks
is also not recommended.
(gtk_signal_next_and_invalidate): added an
assertments which explicits what the code assumes anyways: a
maximum amount of 65535 signals.
* gtk/gtkcontainer.h: deprecated gtk_container_foreach_interp(),
gtk_container_foreach_full() should be used instead.
* gtk/gtkmain.h:
deprecated gtk_timeout_add_interp and gtk_idle_add_interp, since
we provide _full variants.
* gtk/gtksignal.h: deprecated gtk_signal_connect_interp(), we provide
gtk_signal_connect_full() for long enough now.
1998-12-07 02:31:19 +00:00
|
|
|
for (i = 0; i < n_no_stat_dirs; i++)
|
1998-09-12 14:41:04 +00:00
|
|
|
{
|
2004-12-12 21:09:13 +00:00
|
|
|
if (g_stat (no_stat_dirs[i].name, &no_stat_dirs[i].statbuf) == 0)
|
1998-09-12 14:41:04 +00:00
|
|
|
no_stat_dirs[i].present = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-05 21:23:53 +00:00
|
|
|
sys_dir_name = g_filename_from_utf8 (dir_name, -1, NULL, NULL, NULL);
|
2001-03-12 15:39:19 +00:00
|
|
|
if (!sys_dir_name)
|
|
|
|
{
|
|
|
|
cmpl_errno = CMPL_ERRNO_DID_NOT_CONVERT;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-12-12 21:09:13 +00:00
|
|
|
if (g_stat (sys_dir_name, result) < 0)
|
1998-09-12 14:41:04 +00:00
|
|
|
{
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_dir_name);
|
1998-09-12 14:41:04 +00:00
|
|
|
cmpl_errno = errno;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_dir_name);
|
1998-09-12 14:41:04 +00:00
|
|
|
|
|
|
|
*stat_subdirs = TRUE;
|
2000-08-12 07:25:55 +00:00
|
|
|
for (i = 0; i < n_no_stat_dirs; i++)
|
1998-09-12 14:41:04 +00:00
|
|
|
{
|
|
|
|
if (no_stat_dirs[i].present &&
|
|
|
|
(no_stat_dirs[i].statbuf.st_dev == result->st_dev) &&
|
|
|
|
(no_stat_dirs[i].statbuf.st_ino == result->st_ino))
|
|
|
|
{
|
|
|
|
*stat_subdirs = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* open a directory by absolute pathname */
|
|
|
|
static CompletionDir*
|
2000-08-12 07:25:55 +00:00
|
|
|
open_dir (gchar *dir_name,
|
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
1997-11-24 22:37:52 +00:00
|
|
|
struct stat sbuf;
|
1998-09-12 14:41:04 +00:00
|
|
|
gboolean stat_subdirs;
|
1997-11-24 22:37:52 +00:00
|
|
|
GList* cdsl;
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#endif
|
|
|
|
CompletionDirSent *sent;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
1998-09-12 14:41:04 +00:00
|
|
|
if (!check_dir (dir_name, &sbuf, &stat_subdirs))
|
|
|
|
return NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cdsl = cmpl_state->directory_sent_storage;
|
|
|
|
|
|
|
|
while (cdsl)
|
|
|
|
{
|
|
|
|
sent = cdsl->data;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (sent->inode == sbuf.st_ino &&
|
|
|
|
sent->mtime == sbuf.st_mtime &&
|
|
|
|
sent->device == sbuf.st_dev)
|
|
|
|
return attach_dir (sent, dir_name, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cdsl = cdsl->next;
|
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
sent = open_new_dir (dir_name, &sbuf, stat_subdirs);
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#else
|
|
|
|
sent = open_new_dir (dir_name, NULL, TRUE);
|
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (sent)
|
|
|
|
{
|
|
|
|
cmpl_state->directory_sent_storage =
|
|
|
|
g_list_prepend (cmpl_state->directory_sent_storage, sent);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
return attach_dir (sent, dir_name, cmpl_state);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static CompletionDir*
|
2000-08-12 07:25:55 +00:00
|
|
|
attach_dir (CompletionDirSent *sent,
|
|
|
|
gchar *dir_name,
|
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
CompletionDir* new_dir;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
new_dir = g_new (CompletionDir, 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->directory_storage =
|
2000-08-12 07:25:55 +00:00
|
|
|
g_list_prepend (cmpl_state->directory_storage, new_dir);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
new_dir->sent = sent;
|
2000-08-12 07:25:55 +00:00
|
|
|
new_dir->fullname = g_strdup (dir_name);
|
|
|
|
new_dir->fullname_len = strlen (dir_name);
|
2002-02-10 13:18:51 +00:00
|
|
|
new_dir->cmpl_text = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return new_dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2000-08-12 07:25:55 +00:00
|
|
|
correct_dir_fullname (CompletionDir* cmpl_dir)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
gint length = strlen (cmpl_dir->fullname);
|
|
|
|
gchar *first_slash = strchr (cmpl_dir->fullname, G_DIR_SEPARATOR);
|
2000-08-12 07:37:27 +00:00
|
|
|
gchar *sys_filename;
|
1997-11-24 22:37:52 +00:00
|
|
|
struct stat sbuf;
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
/* Does it end with /. (\.) ? */
|
|
|
|
if (length >= 2 &&
|
2000-08-12 07:25:55 +00:00
|
|
|
strcmp (cmpl_dir->fullname + length - 2, G_DIR_SEPARATOR_S ".") == 0)
|
1998-01-11 04:03:32 +00:00
|
|
|
{
|
1999-03-13 01:14:19 +00:00
|
|
|
/* Is it just the root directory (on a drive) ? */
|
|
|
|
if (cmpl_dir->fullname + length - 2 == first_slash)
|
1998-01-11 04:03:32 +00:00
|
|
|
{
|
1999-03-13 01:14:19 +00:00
|
|
|
cmpl_dir->fullname[length - 1] = 0;
|
|
|
|
cmpl_dir->fullname_len = length - 1;
|
1998-01-11 04:03:32 +00:00
|
|
|
return TRUE;
|
1999-03-13 01:14:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-01-11 04:03:32 +00:00
|
|
|
cmpl_dir->fullname[length - 2] = 0;
|
|
|
|
}
|
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
|
|
|
|
/* Ends with /./ (\.\)? */
|
|
|
|
else if (length >= 3 &&
|
2000-08-12 07:25:55 +00:00
|
|
|
strcmp (cmpl_dir->fullname + length - 3,
|
|
|
|
G_DIR_SEPARATOR_S "." G_DIR_SEPARATOR_S) == 0)
|
1998-01-11 04:03:32 +00:00
|
|
|
cmpl_dir->fullname[length - 2] = 0;
|
1999-03-13 01:14:19 +00:00
|
|
|
|
|
|
|
/* Ends with /.. (\..) ? */
|
|
|
|
else if (length >= 3 &&
|
2000-08-12 07:25:55 +00:00
|
|
|
strcmp (cmpl_dir->fullname + length - 3,
|
|
|
|
G_DIR_SEPARATOR_S "..") == 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-03-13 01:14:19 +00:00
|
|
|
/* Is it just /.. (X:\..)? */
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cmpl_dir->fullname + length - 3 == first_slash)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-03-13 01:14:19 +00:00
|
|
|
cmpl_dir->fullname[length - 2] = 0;
|
|
|
|
cmpl_dir->fullname_len = length - 2;
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-01-05 21:23:53 +00:00
|
|
|
sys_filename = g_filename_from_utf8 (cmpl_dir->fullname, -1, NULL, NULL, NULL);
|
2001-03-12 15:39:19 +00:00
|
|
|
if (!sys_filename)
|
|
|
|
{
|
|
|
|
cmpl_errno = CMPL_ERRNO_DID_NOT_CONVERT;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-12-12 21:09:13 +00:00
|
|
|
if (g_stat (sys_filename, &sbuf) < 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_filename);
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_errno = errno;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_filename);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
cmpl_dir->fullname[length - 3] = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!correct_parent (cmpl_dir, &sbuf))
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
1999-03-13 01:14:19 +00:00
|
|
|
|
|
|
|
/* Ends with /../ (\..\)? */
|
|
|
|
else if (length >= 4 &&
|
2000-08-12 07:25:55 +00:00
|
|
|
strcmp (cmpl_dir->fullname + length - 4,
|
|
|
|
G_DIR_SEPARATOR_S ".." G_DIR_SEPARATOR_S) == 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-03-13 01:14:19 +00:00
|
|
|
/* Is it just /../ (X:\..\)? */
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cmpl_dir->fullname + length - 4 == first_slash)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-03-13 01:14:19 +00:00
|
|
|
cmpl_dir->fullname[length - 3] = 0;
|
|
|
|
cmpl_dir->fullname_len = length - 3;
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-01-05 21:23:53 +00:00
|
|
|
sys_filename = g_filename_from_utf8 (cmpl_dir->fullname, -1, NULL, NULL, NULL);
|
2001-03-12 15:39:19 +00:00
|
|
|
if (!sys_filename)
|
|
|
|
{
|
|
|
|
cmpl_errno = CMPL_ERRNO_DID_NOT_CONVERT;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-12-12 21:09:13 +00:00
|
|
|
if (g_stat (sys_filename, &sbuf) < 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_filename);
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_errno = errno;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_filename);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
cmpl_dir->fullname[length - 4] = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!correct_parent (cmpl_dir, &sbuf))
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_dir->fullname_len = strlen (cmpl_dir->fullname);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2000-08-12 07:25:55 +00:00
|
|
|
correct_parent (CompletionDir *cmpl_dir,
|
|
|
|
struct stat *sbuf)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
struct stat parbuf;
|
|
|
|
gchar *last_slash;
|
1999-03-13 01:14:19 +00:00
|
|
|
gchar *first_slash;
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar *new_name;
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#endif
|
2000-08-12 07:37:27 +00:00
|
|
|
gchar *sys_filename;
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar c = 0;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
last_slash = strrchr (cmpl_dir->fullname, G_DIR_SEPARATOR);
|
|
|
|
g_assert (last_slash);
|
|
|
|
first_slash = strchr (cmpl_dir->fullname, G_DIR_SEPARATOR);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
/* Clever (?) way to check for top-level directory that works also on
|
|
|
|
* Win32, where there is a drive letter and colon prefixed...
|
|
|
|
*/
|
|
|
|
if (last_slash != first_slash)
|
|
|
|
{
|
|
|
|
last_slash[0] = 0;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
c = last_slash[1];
|
|
|
|
last_slash[1] = 0;
|
|
|
|
}
|
|
|
|
|
2001-01-05 21:23:53 +00:00
|
|
|
sys_filename = g_filename_from_utf8 (cmpl_dir->fullname, -1, NULL, NULL, NULL);
|
2001-03-12 15:39:19 +00:00
|
|
|
if (!sys_filename)
|
|
|
|
{
|
|
|
|
cmpl_errno = CMPL_ERRNO_DID_NOT_CONVERT;
|
|
|
|
if (!c)
|
|
|
|
last_slash[0] = G_DIR_SEPARATOR;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-12-12 21:09:13 +00:00
|
|
|
if (g_stat (sys_filename, &parbuf) < 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_filename);
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_errno = errno;
|
1999-03-13 01:14:19 +00:00
|
|
|
if (!c)
|
|
|
|
last_slash[0] = G_DIR_SEPARATOR;
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_filename);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32 /* No inode numbers on Win32 */
|
1997-11-24 22:37:52 +00:00
|
|
|
if (parbuf.st_ino == sbuf->st_ino && parbuf.st_dev == sbuf->st_dev)
|
|
|
|
/* it wasn't a link */
|
|
|
|
return TRUE;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (c)
|
1997-11-24 22:37:52 +00:00
|
|
|
last_slash[1] = c;
|
1999-03-13 01:14:19 +00:00
|
|
|
else
|
|
|
|
last_slash[0] = G_DIR_SEPARATOR;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* it was a link, have to figure it out the hard way */
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
new_name = find_parent_dir_fullname (cmpl_dir->fullname);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (!new_name)
|
|
|
|
return FALSE;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
g_free (cmpl_dir->fullname);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_dir->fullname = new_name;
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
1999-03-13 01:14:19 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static gchar*
|
2000-08-12 07:25:55 +00:00
|
|
|
find_parent_dir_fullname (gchar* dirname)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:45:56 +00:00
|
|
|
gchar *sys_orig_dir;
|
1999-03-13 01:14:19 +00:00
|
|
|
gchar *result;
|
2000-08-12 07:37:27 +00:00
|
|
|
gchar *sys_cwd;
|
|
|
|
gchar *sys_dirname;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:45:56 +00:00
|
|
|
sys_orig_dir = g_get_current_dir ();
|
2001-01-05 21:23:53 +00:00
|
|
|
sys_dirname = g_filename_from_utf8 (dirname, -1, NULL, NULL, NULL);
|
2001-03-12 15:39:19 +00:00
|
|
|
if (!sys_dirname)
|
|
|
|
{
|
|
|
|
g_free (sys_orig_dir);
|
|
|
|
cmpl_errno = CMPL_ERRNO_DID_NOT_CONVERT;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-08-12 07:37:27 +00:00
|
|
|
if (chdir (sys_dirname) != 0 || chdir ("..") != 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2002-12-13 23:18:03 +00:00
|
|
|
cmpl_errno = errno;
|
|
|
|
chdir (sys_orig_dir);
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_dirname);
|
2000-08-12 15:02:17 +00:00
|
|
|
g_free (sys_orig_dir);
|
1997-11-24 22:37:52 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_dirname);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:37:27 +00:00
|
|
|
sys_cwd = g_get_current_dir ();
|
2001-01-05 21:23:53 +00:00
|
|
|
result = g_filename_to_utf8 (sys_cwd, -1, NULL, NULL, NULL);
|
2000-08-12 07:37:27 +00:00
|
|
|
g_free (sys_cwd);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:45:56 +00:00
|
|
|
if (chdir (sys_orig_dir) != 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
cmpl_errno = errno;
|
2000-08-12 15:02:17 +00:00
|
|
|
g_free (sys_orig_dir);
|
1997-11-24 22:37:52 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-08-12 07:45:56 +00:00
|
|
|
g_free (sys_orig_dir);
|
1999-03-13 01:14:19 +00:00
|
|
|
return result;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
/* Completion Operations */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static PossibleCompletion*
|
2000-08-12 07:25:55 +00:00
|
|
|
attempt_homedir_completion (gchar *text_to_complete,
|
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2005-09-13 19:57:42 +00:00
|
|
|
gint index;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (!cmpl_state->user_dir_name_buffer &&
|
2000-08-12 07:25:55 +00:00
|
|
|
!get_pwdb (cmpl_state))
|
1997-11-24 22:37:52 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
cmpl_state->user_completion_index += 1;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
while (cmpl_state->user_completion_index < cmpl_state->user_directories_len)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
index = first_diff_index (text_to_complete + 1,
|
|
|
|
cmpl_state->user_directories
|
|
|
|
[cmpl_state->user_completion_index].login);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
switch (index)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
case PATTERN_MATCH:
|
|
|
|
break;
|
|
|
|
default:
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cmpl_state->last_valid_char < (index + 1))
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_state->last_valid_char = index + 1;
|
|
|
|
cmpl_state->user_completion_index += 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmpl_state->the_completion.is_a_completion = 1;
|
2000-02-03 01:19:03 +00:00
|
|
|
cmpl_state->the_completion.is_directory = TRUE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
append_completion_text ("~", cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
append_completion_text (cmpl_state->
|
1997-11-24 22:37:52 +00:00
|
|
|
user_directories[cmpl_state->user_completion_index].login,
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
return append_completion_text (G_DIR_SEPARATOR_S, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (text_to_complete[1]
|
|
|
|
|| cmpl_state->user_completion_index > cmpl_state->user_directories_len)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
cmpl_state->user_completion_index = -1;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmpl_state->user_completion_index += 1;
|
|
|
|
cmpl_state->the_completion.is_a_completion = 1;
|
2000-02-03 01:19:03 +00:00
|
|
|
cmpl_state->the_completion.is_directory = TRUE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
return append_completion_text ("~" G_DIR_SEPARATOR_S, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
#ifdef G_PLATFORM_WIN32
|
|
|
|
/* FIXME: determine whether we should casefold all Unicode letters
|
|
|
|
* here, too (and in in first_diff_index() walk through the strings with
|
|
|
|
* g_utf8_next_char()), or if this folding isn't actually needed at
|
|
|
|
* all.
|
|
|
|
*/
|
1999-03-13 01:14:19 +00:00
|
|
|
#define FOLD(c) (tolower(c))
|
|
|
|
#else
|
|
|
|
#define FOLD(c) (c)
|
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* returns the index (>= 0) of the first differing character,
|
|
|
|
* PATTERN_MATCH if the completion matches */
|
|
|
|
static gint
|
2000-08-12 07:25:55 +00:00
|
|
|
first_diff_index (gchar *pat,
|
|
|
|
gchar *text)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gint diff = 0;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
while (*pat && *text && FOLD (*text) == FOLD (*pat))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
pat += 1;
|
|
|
|
text += 1;
|
|
|
|
diff += 1;
|
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (*pat)
|
1997-11-24 22:37:52 +00:00
|
|
|
return diff;
|
|
|
|
|
|
|
|
return PATTERN_MATCH;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PossibleCompletion*
|
2000-08-12 07:25:55 +00:00
|
|
|
append_completion_text (gchar *text,
|
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gint len, i = 1;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!cmpl_state->the_completion.text)
|
1997-11-24 22:37:52 +00:00
|
|
|
return NULL;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
len = strlen (text) + strlen (cmpl_state->the_completion.text) + 1;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cmpl_state->the_completion.text_alloc > len)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
strcat (cmpl_state->the_completion.text, text);
|
1997-11-24 22:37:52 +00:00
|
|
|
return &cmpl_state->the_completion;
|
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
while (i < len)
|
|
|
|
i <<= 1;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->the_completion.text_alloc = i;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_state->the_completion.text = (gchar*) g_realloc (cmpl_state->the_completion.text, i);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!cmpl_state->the_completion.text)
|
1997-11-24 22:37:52 +00:00
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
strcat (cmpl_state->the_completion.text, text);
|
1997-11-24 22:37:52 +00:00
|
|
|
return &cmpl_state->the_completion;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static CompletionDir*
|
2000-08-12 07:25:55 +00:00
|
|
|
find_completion_dir (gchar *text_to_complete,
|
|
|
|
gchar **remaining_text,
|
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
gchar* first_slash = strchr (text_to_complete, G_DIR_SEPARATOR);
|
1997-11-24 22:37:52 +00:00
|
|
|
CompletionDir* dir = cmpl_state->reference_dir;
|
1998-09-12 14:41:04 +00:00
|
|
|
CompletionDir* next;
|
1997-11-24 22:37:52 +00:00
|
|
|
*remaining_text = text_to_complete;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
while (first_slash)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gint len = first_slash - *remaining_text;
|
|
|
|
gint found = 0;
|
1998-09-12 14:41:04 +00:00
|
|
|
gchar *found_name = NULL; /* Quiet gcc */
|
1997-11-24 22:37:52 +00:00
|
|
|
gint i;
|
|
|
|
gchar* pat_buf = g_new (gchar, len + 1);
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
strncpy (pat_buf, *remaining_text, len);
|
1997-11-24 22:37:52 +00:00
|
|
|
pat_buf[len] = 0;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
for (i = 0; i < dir->sent->entry_count; i += 1)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
if (dir->sent->entries[i].is_dir &&
|
2004-06-02 17:46:21 +00:00
|
|
|
_gtk_fnmatch (pat_buf, dir->sent->entries[i].entry_name, TRUE))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
if (found)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_free (pat_buf);
|
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
found = 1;
|
1998-09-12 14:41:04 +00:00
|
|
|
found_name = dir->sent->entries[i].entry_name;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-09-12 14:41:04 +00:00
|
|
|
if (!found)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-09-12 14:41:04 +00:00
|
|
|
/* Perhaps we are trying to open an automount directory */
|
|
|
|
found_name = pat_buf;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-09-12 14:41:04 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
next = open_relative_dir (found_name, dir, cmpl_state);
|
1998-09-12 14:41:04 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!next)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_free (pat_buf);
|
|
|
|
return NULL;
|
2002-12-13 23:18:03 +00:00
|
|
|
}
|
1998-09-12 14:41:04 +00:00
|
|
|
|
|
|
|
next->cmpl_parent = dir;
|
|
|
|
|
|
|
|
dir = next;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!correct_dir_fullname (dir))
|
1998-09-12 14:41:04 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
g_free (pat_buf);
|
1998-09-12 14:41:04 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*remaining_text = first_slash + 1;
|
2000-08-12 07:25:55 +00:00
|
|
|
first_slash = strchr (*remaining_text, G_DIR_SEPARATOR);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_free (pat_buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-12 07:25:55 +00:00
|
|
|
update_cmpl (PossibleCompletion *poss,
|
|
|
|
CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gint cmpl_len;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!poss || !cmpl_is_a_completion (poss))
|
1997-11-24 22:37:52 +00:00
|
|
|
return;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_len = strlen (cmpl_this_completion (poss));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cmpl_state->updated_text_alloc < cmpl_len + 1)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2003-08-01 20:46:44 +00:00
|
|
|
cmpl_state->updated_text_alloc = 2*cmpl_len;
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_state->updated_text =
|
2000-08-12 07:25:55 +00:00
|
|
|
(gchar*)g_realloc (cmpl_state->updated_text,
|
|
|
|
cmpl_state->updated_text_alloc);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cmpl_state->updated_text_len < 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
strcpy (cmpl_state->updated_text, cmpl_this_completion (poss));
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_state->updated_text_len = cmpl_len;
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_state->re_complete = cmpl_is_directory (poss);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
2000-08-12 07:25:55 +00:00
|
|
|
else if (cmpl_state->updated_text_len == 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
cmpl_state->re_complete = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gint first_diff =
|
2000-08-12 07:25:55 +00:00
|
|
|
first_diff_index (cmpl_state->updated_text,
|
|
|
|
cmpl_this_completion (poss));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->re_complete = FALSE;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (first_diff == PATTERN_MATCH)
|
1997-11-24 22:37:52 +00:00
|
|
|
return;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (first_diff > cmpl_state->updated_text_len)
|
|
|
|
strcpy (cmpl_state->updated_text, cmpl_this_completion (poss));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->updated_text_len = first_diff;
|
|
|
|
cmpl_state->updated_text[first_diff] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static PossibleCompletion*
|
2000-08-12 07:25:55 +00:00
|
|
|
attempt_file_completion (CompletionState *cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gchar *pat_buf, *first_slash;
|
|
|
|
CompletionDir *dir = cmpl_state->active_completion_dir;
|
|
|
|
|
|
|
|
dir->cmpl_index += 1;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (dir->cmpl_index == dir->sent->entry_count)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
if (dir->cmpl_parent == NULL)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
cmpl_state->active_completion_dir = NULL;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmpl_state->active_completion_dir = dir->cmpl_parent;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
return attempt_file_completion (cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
g_assert (dir->cmpl_text);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
first_slash = strchr (dir->cmpl_text, G_DIR_SEPARATOR);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (first_slash)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gint len = first_slash - dir->cmpl_text;
|
|
|
|
|
|
|
|
pat_buf = g_new (gchar, len + 1);
|
2000-08-12 07:25:55 +00:00
|
|
|
strncpy (pat_buf, dir->cmpl_text, len);
|
1997-11-24 22:37:52 +00:00
|
|
|
pat_buf[len] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
gint len = strlen (dir->cmpl_text);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
pat_buf = g_new (gchar, len + 2);
|
2000-08-12 07:25:55 +00:00
|
|
|
strcpy (pat_buf, dir->cmpl_text);
|
1999-03-13 01:24:10 +00:00
|
|
|
/* Don't append a * if the user entered one herself.
|
|
|
|
* This way one can complete *.h and don't get matches
|
|
|
|
* on any .help files, for instance.
|
|
|
|
*/
|
2000-08-12 07:25:55 +00:00
|
|
|
if (strchr (pat_buf, '*') == NULL)
|
|
|
|
strcpy (pat_buf + len, "*");
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (first_slash)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
if (dir->sent->entries[dir->cmpl_index].is_dir)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2004-06-02 17:46:21 +00:00
|
|
|
if (_gtk_fnmatch (pat_buf, dir->sent->entries[dir->cmpl_index].entry_name, TRUE))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
CompletionDir* new_dir;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
new_dir = open_relative_dir (dir->sent->entries[dir->cmpl_index].entry_name,
|
|
|
|
dir, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (!new_dir)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_free (pat_buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_dir->cmpl_parent = dir;
|
|
|
|
|
|
|
|
new_dir->cmpl_index = -1;
|
2002-02-10 13:18:51 +00:00
|
|
|
new_dir->cmpl_text = g_strdup (first_slash + 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->active_completion_dir = new_dir;
|
|
|
|
|
|
|
|
g_free (pat_buf);
|
2000-08-12 07:25:55 +00:00
|
|
|
return attempt_file_completion (cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_free (pat_buf);
|
2000-08-12 07:25:55 +00:00
|
|
|
return attempt_file_completion (cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_free (pat_buf);
|
2000-08-12 07:25:55 +00:00
|
|
|
return attempt_file_completion (cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
if (dir->cmpl_parent != NULL)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
append_completion_text (dir->fullname +
|
|
|
|
strlen (cmpl_state->completion_dir->fullname) + 1,
|
|
|
|
cmpl_state);
|
|
|
|
append_completion_text (G_DIR_SEPARATOR_S, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
append_completion_text (dir->sent->entries[dir->cmpl_index].entry_name, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->the_completion.is_a_completion =
|
2004-06-02 17:46:21 +00:00
|
|
|
_gtk_fnmatch (pat_buf, dir->sent->entries[dir->cmpl_index].entry_name, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->the_completion.is_directory = dir->sent->entries[dir->cmpl_index].is_dir;
|
2000-08-12 07:25:55 +00:00
|
|
|
if (dir->sent->entries[dir->cmpl_index].is_dir)
|
|
|
|
append_completion_text (G_DIR_SEPARATOR_S, cmpl_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_free (pat_buf);
|
|
|
|
return &cmpl_state->the_completion;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#ifdef HAVE_PWD_H
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static gint
|
2000-08-12 07:25:55 +00:00
|
|
|
get_pwdb (CompletionState* cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
struct passwd *pwd_ptr;
|
1998-03-24 05:27:00 +00:00
|
|
|
gchar* buf_ptr;
|
2000-08-12 07:25:55 +00:00
|
|
|
gchar *utf8;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint len = 0, i, count = 0;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cmpl_state->user_dir_name_buffer)
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
setpwent ();
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
while ((pwd_ptr = getpwent ()) != NULL)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2001-01-05 21:23:53 +00:00
|
|
|
utf8 = g_filename_to_utf8 (pwd_ptr->pw_name, -1, NULL, NULL, NULL);
|
2000-08-12 07:25:55 +00:00
|
|
|
len += strlen (utf8);
|
|
|
|
g_free (utf8);
|
2001-01-05 21:23:53 +00:00
|
|
|
utf8 = g_filename_to_utf8 (pwd_ptr->pw_dir, -1, NULL, NULL, NULL);
|
2000-08-12 07:25:55 +00:00
|
|
|
len += strlen (utf8);
|
|
|
|
g_free (utf8);
|
1997-11-24 22:37:52 +00:00
|
|
|
len += 2;
|
|
|
|
count += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
setpwent ();
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_state->user_dir_name_buffer = g_new (gchar, len);
|
|
|
|
cmpl_state->user_directories = g_new (CompletionUserDir, count);
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_state->user_directories_len = count;
|
|
|
|
|
|
|
|
buf_ptr = cmpl_state->user_dir_name_buffer;
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
for (i = 0; i < count; i += 1)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
pwd_ptr = getpwent ();
|
|
|
|
if (!pwd_ptr)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
cmpl_errno = errno;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2001-01-05 21:23:53 +00:00
|
|
|
utf8 = g_filename_to_utf8 (pwd_ptr->pw_name, -1, NULL, NULL, NULL);
|
2000-08-12 07:25:55 +00:00
|
|
|
strcpy (buf_ptr, utf8);
|
|
|
|
g_free (utf8);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_state->user_directories[i].login = buf_ptr;
|
2000-08-12 07:25:55 +00:00
|
|
|
|
|
|
|
buf_ptr += strlen (buf_ptr);
|
1997-11-24 22:37:52 +00:00
|
|
|
buf_ptr += 1;
|
2000-08-12 07:25:55 +00:00
|
|
|
|
2001-01-05 21:23:53 +00:00
|
|
|
utf8 = g_filename_to_utf8 (pwd_ptr->pw_dir, -1, NULL, NULL, NULL);
|
2000-08-12 07:25:55 +00:00
|
|
|
strcpy (buf_ptr, utf8);
|
|
|
|
g_free (utf8);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
cmpl_state->user_directories[i].homedir = buf_ptr;
|
2000-08-12 07:25:55 +00:00
|
|
|
|
|
|
|
buf_ptr += strlen (buf_ptr);
|
1997-11-24 22:37:52 +00:00
|
|
|
buf_ptr += 1;
|
|
|
|
}
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
qsort (cmpl_state->user_directories,
|
|
|
|
cmpl_state->user_directories_len,
|
|
|
|
sizeof (CompletionUserDir),
|
|
|
|
compare_user_dir);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
endpwent ();
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
2000-08-12 07:25:55 +00:00
|
|
|
if (cmpl_state->user_dir_name_buffer)
|
|
|
|
g_free (cmpl_state->user_dir_name_buffer);
|
|
|
|
if (cmpl_state->user_directories)
|
|
|
|
g_free (cmpl_state->user_directories);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
cmpl_state->user_dir_name_buffer = NULL;
|
|
|
|
cmpl_state->user_directories = NULL;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2000-08-12 07:25:55 +00:00
|
|
|
compare_user_dir (const void *a,
|
|
|
|
const void *b)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
return strcmp ((((CompletionUserDir*)a))->login,
|
|
|
|
(((CompletionUserDir*)b))->login);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1999-03-13 01:14:19 +00:00
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint
|
2000-08-12 07:25:55 +00:00
|
|
|
compare_cmpl_dir (const void *a,
|
|
|
|
const void *b)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2002-12-13 23:28:56 +00:00
|
|
|
|
|
|
|
return strcmp (((CompletionDirEntry*)a)->sort_key,
|
|
|
|
(((CompletionDirEntry*)b))->sort_key);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_state_okay (CompletionState* cmpl_state)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
return cmpl_state && cmpl_state->reference_dir;
|
|
|
|
}
|
|
|
|
|
2001-10-23 16:02:23 +00:00
|
|
|
static const gchar*
|
2000-08-12 07:25:55 +00:00
|
|
|
cmpl_strerror (gint err)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2000-08-12 07:25:55 +00:00
|
|
|
if (err == CMPL_ERRNO_TOO_LONG)
|
2001-03-12 15:39:19 +00:00
|
|
|
return _("Name too long");
|
|
|
|
else if (err == CMPL_ERRNO_DID_NOT_CONVERT)
|
|
|
|
return _("Couldn't convert filename");
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
return g_strerror (err);
|
|
|
|
}
|
2004-12-12 21:09:13 +00:00
|
|
|
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
|
|
|
|
/* DLL ABI stability backward compatibility versions */
|
|
|
|
|
|
|
|
#undef gtk_file_selection_get_filename
|
|
|
|
|
|
|
|
G_CONST_RETURN gchar*
|
|
|
|
gtk_file_selection_get_filename (GtkFileSelection *filesel)
|
|
|
|
{
|
|
|
|
static gchar retval[MAXPATHLEN*2+1];
|
|
|
|
gchar *tem;
|
|
|
|
|
|
|
|
tem = g_locale_from_utf8 (gtk_file_selection_get_filename_utf8 (filesel),
|
|
|
|
-1, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
strncpy (retval, tem, sizeof (retval) - 1);
|
|
|
|
retval[sizeof (retval) - 1] = '\0';
|
|
|
|
g_free (tem);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef gtk_file_selection_set_filename
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_file_selection_set_filename (GtkFileSelection *filesel,
|
|
|
|
const gchar *filename)
|
|
|
|
{
|
|
|
|
gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
|
|
|
|
gtk_file_selection_set_filename_utf8 (filesel, utf8_filename);
|
|
|
|
g_free (utf8_filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef gtk_file_selection_get_selections
|
|
|
|
|
|
|
|
gchar **
|
|
|
|
gtk_file_selection_get_selections (GtkFileSelection *filesel)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
gchar **selections = gtk_file_selection_get_selections_utf8 (filesel);
|
|
|
|
|
|
|
|
if (selections != NULL)
|
|
|
|
while (selections[i] != NULL)
|
|
|
|
{
|
|
|
|
gchar *tem = selections[i];
|
|
|
|
selections[i] = g_locale_from_utf8 (selections[i],
|
|
|
|
-1, NULL, NULL, NULL);
|
|
|
|
g_free (tem);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return selections;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* G_OS_WIN32 */
|
2005-03-20 07:01:23 +00:00
|
|
|
|
|
|
|
#define __GTK_FILESEL_C__
|
|
|
|
#include "gtkaliasdef.c"
|