mirror of
https://git.yoctoproject.org/poky
synced 2026-05-07 16:59:22 +00:00
modified GtkFileChooserDialog for embedded
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2596 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
Index: gtk+-2.10.14/gtk/gtkfilechooserdialog.c
|
||||
===================================================================
|
||||
--- gtk+-2.10.14.orig/gtk/gtkfilechooserdialog.c 2007-08-29 18:03:04.000000000 +0100
|
||||
+++ gtk+-2.10.14/gtk/gtkfilechooserdialog.c 2007-08-29 18:04:27.000000000 +0100
|
||||
@@ -50,8 +50,6 @@
|
||||
|
||||
static void gtk_file_chooser_dialog_map (GtkWidget *widget);
|
||||
static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
|
||||
-static void gtk_file_chooser_dialog_style_set (GtkWidget *widget,
|
||||
- GtkStyle *previous_style);
|
||||
|
||||
static void response_cb (GtkDialog *dialog,
|
||||
gint response_id);
|
||||
@@ -73,7 +71,6 @@
|
||||
|
||||
widget_class->map = gtk_file_chooser_dialog_map;
|
||||
widget_class->unmap = gtk_file_chooser_dialog_unmap;
|
||||
- widget_class->style_set = gtk_file_chooser_dialog_style_set;
|
||||
|
||||
_gtk_file_chooser_install_properties (gobject_class);
|
||||
|
||||
@@ -86,10 +83,16 @@
|
||||
GtkFileChooserDialogPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog,
|
||||
GTK_TYPE_FILE_CHOOSER_DIALOG,
|
||||
GtkFileChooserDialogPrivate);
|
||||
+
|
||||
+ GtkDialog *fc_dialog = GTK_DIALOG (dialog);
|
||||
+
|
||||
dialog->priv = priv;
|
||||
dialog->priv->response_requested = FALSE;
|
||||
|
||||
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
|
||||
+ gtk_dialog_set_has_separator (fc_dialog, FALSE);
|
||||
+ gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), 5);
|
||||
+ gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
+ gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), 5);
|
||||
|
||||
/* We do a signal connection here rather than overriding the method in
|
||||
* class_init because GtkDialog::response is a RUN_LAST signal. We want *our*
|
||||
@@ -285,6 +288,7 @@
|
||||
g_signal_connect (priv->widget, "response-requested",
|
||||
G_CALLBACK (file_chooser_widget_response_requested), object);
|
||||
|
||||
+ gtk_container_set_border_width (GTK_CONTAINER (priv->widget), 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (priv->widget);
|
||||
@@ -414,29 +418,6 @@
|
||||
gtk_widget_unmap (priv->widget);
|
||||
}
|
||||
|
||||
-static void
|
||||
-gtk_file_chooser_dialog_style_set (GtkWidget *widget,
|
||||
- GtkStyle *previous_style)
|
||||
-{
|
||||
- GtkDialog *dialog;
|
||||
-
|
||||
- if (GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->style_set)
|
||||
- GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->style_set (widget, previous_style);
|
||||
-
|
||||
- dialog = GTK_DIALOG (widget);
|
||||
-
|
||||
- /* Override the style properties with HIG-compliant spacings. Ugh.
|
||||
- * http://developer.gnome.org/projects/gup/hig/1.0/layout.html#layout-dialogs
|
||||
- * http://developer.gnome.org/projects/gup/hig/1.0/windows.html#alert-spacing
|
||||
- */
|
||||
-
|
||||
- gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), 12);
|
||||
- gtk_box_set_spacing (GTK_BOX (dialog->vbox), 24);
|
||||
-
|
||||
- gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 0);
|
||||
- gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
|
||||
-}
|
||||
-
|
||||
/* GtkDialog::response handler */
|
||||
static void
|
||||
response_cb (GtkDialog *dialog,
|
||||
@@ -0,0 +1,32 @@
|
||||
Index: gtk+-2.10.14/gtk/gtkfilechooserutils.h
|
||||
===================================================================
|
||||
--- gtk+-2.10.14.orig/gtk/gtkfilechooserutils.h 2007-08-24 08:37:40.000000000 +0100
|
||||
+++ gtk+-2.10.14/gtk/gtkfilechooserutils.h 2007-08-24 08:51:59.000000000 +0100
|
||||
@@ -41,7 +41,9 @@
|
||||
GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE,
|
||||
GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN,
|
||||
GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION,
|
||||
- GTK_FILE_CHOOSER_PROP_LAST = GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION
|
||||
+ GTK_FILE_CHOOSER_PROP_ROOT_FOLDER,
|
||||
+ GTK_FILE_CHOOSER_PROP_SHOW_CREATE_FOLDER,
|
||||
+ GTK_FILE_CHOOSER_PROP_LAST = GTK_FILE_CHOOSER_PROP_SHOW_CREATE_FOLDER
|
||||
} GtkFileChooserProp;
|
||||
|
||||
void _gtk_file_chooser_install_properties (GObjectClass *klass);
|
||||
Index: gtk+-2.10.14/gtk/gtkfilechooserutils.c
|
||||
===================================================================
|
||||
--- gtk+-2.10.14.orig/gtk/gtkfilechooserutils.c 2007-08-24 08:37:28.000000000 +0100
|
||||
+++ gtk+-2.10.14/gtk/gtkfilechooserutils.c 2007-08-24 08:51:47.000000000 +0100
|
||||
@@ -117,6 +117,12 @@
|
||||
g_object_class_override_property (klass,
|
||||
GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION,
|
||||
"do-overwrite-confirmation");
|
||||
+ g_object_class_override_property (klass,
|
||||
+ GTK_FILE_CHOOSER_PROP_ROOT_FOLDER,
|
||||
+ "root-folder");
|
||||
+ g_object_class_override_property (klass,
|
||||
+ GTK_FILE_CHOOSER_PROP_SHOW_CREATE_FOLDER,
|
||||
+ "show-create-folder");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,25 @@
|
||||
Index: gtk+-2.10.14/gtk/gtkfilechooser.c
|
||||
===================================================================
|
||||
--- gtk+-2.10.14.orig/gtk/gtkfilechooser.c 2007-08-24 08:52:32.000000000 +0100
|
||||
+++ gtk+-2.10.14/gtk/gtkfilechooser.c 2007-08-24 08:57:21.000000000 +0100
|
||||
@@ -272,6 +272,20 @@
|
||||
"if necessary."),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE));
|
||||
+
|
||||
+ g_object_interface_install_property (g_iface,
|
||||
+ g_param_spec_string ("root-folder",
|
||||
+ P_("File System Root"),
|
||||
+ P_("Root folder for the file system below which the user should not be able to switch"),
|
||||
+ NULL,
|
||||
+ G_PARAM_WRITABLE));
|
||||
+
|
||||
+ g_object_interface_install_property (g_iface,
|
||||
+ g_param_spec_boolean ("show-create-folder",
|
||||
+ P_("Show Create Folder button"),
|
||||
+ P_("Whether the Create Folder button should be visible on the bar"),
|
||||
+ TRUE,
|
||||
+ G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,198 @@
|
||||
Index: gtk+-2.10.14/gtk/gtkfilesystemunix.c
|
||||
===================================================================
|
||||
--- gtk+-2.10.14.orig/gtk/gtkfilesystemunix.c 2007-07-16 20:44:17.000000000 +0100
|
||||
+++ gtk+-2.10.14/gtk/gtkfilesystemunix.c 2007-08-24 08:29:43.000000000 +0100
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <sys/statvfs.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@@ -475,7 +476,55 @@
|
||||
static GSList *
|
||||
gtk_file_system_unix_list_volumes (GtkFileSystem *file_system)
|
||||
{
|
||||
- return g_slist_append (NULL, get_root_volume ());
|
||||
+ struct statvfs stv;
|
||||
+ struct stat st;
|
||||
+ GSList * l = g_slist_append (NULL, get_root_volume ());
|
||||
+
|
||||
+ if (!statvfs ("/.", &stv))
|
||||
+ {
|
||||
+ fsblkcnt_t root_blocks = stv.f_blocks;
|
||||
+ fsfilcnt_t root_files = stv.f_files;
|
||||
+
|
||||
+ GDir * dir;
|
||||
+ if ((dir = g_dir_open ("/media", 0, NULL)) != NULL)
|
||||
+ {
|
||||
+ const gchar * name;
|
||||
+ while ((name = g_dir_read_name (dir)) != NULL)
|
||||
+ {
|
||||
+ gchar * abs_name;
|
||||
+
|
||||
+ /* Skip ram disks */
|
||||
+ if (!strcmp (name, "ram"))
|
||||
+ continue;
|
||||
+
|
||||
+ abs_name = g_strconcat ("/media/", name, NULL);
|
||||
+
|
||||
+ if (!stat (abs_name, &st) && S_ISDIR (st.st_mode))
|
||||
+ {
|
||||
+ gchar * dot = g_strconcat (abs_name, "/.", NULL);
|
||||
+ if (!statvfs (dot, &stv) &&
|
||||
+ (stv.f_blocks != root_blocks ||
|
||||
+ stv.f_files != root_files))
|
||||
+ {
|
||||
+ GtkFilePath * path =
|
||||
+ gtk_file_system_filename_to_path (file_system,
|
||||
+ abs_name);
|
||||
+
|
||||
+ if (path)
|
||||
+ l = g_slist_append (l, path);
|
||||
+ }
|
||||
+
|
||||
+ g_free (dot);
|
||||
+ }
|
||||
+
|
||||
+ g_free (abs_name);
|
||||
+ }
|
||||
+
|
||||
+ g_dir_close (dir);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return l;
|
||||
}
|
||||
|
||||
static GtkFileSystemVolume *
|
||||
@@ -489,13 +538,18 @@
|
||||
remove_trailing_slash (const char *filename)
|
||||
{
|
||||
int len;
|
||||
-
|
||||
+
|
||||
len = strlen (filename);
|
||||
|
||||
- if (len > 1 && filename[len - 1] == '/')
|
||||
- return g_strndup (filename, len - 1);
|
||||
- else
|
||||
- return g_memdup (filename, len + 1);
|
||||
+ if (len > 1)
|
||||
+ {
|
||||
+ gchar *c = g_utf8_prev_char (filename + len);
|
||||
+
|
||||
+ if (c && *c == '/')
|
||||
+ return g_strndup (filename, len - 1);
|
||||
+ }
|
||||
+
|
||||
+ return g_memdup (filename, len + 1);
|
||||
}
|
||||
|
||||
/* Delay callback dispatching
|
||||
@@ -1143,7 +1197,7 @@
|
||||
gtk_file_system_unix_volume_get_base_path (GtkFileSystem *file_system,
|
||||
GtkFileSystemVolume *volume)
|
||||
{
|
||||
- return gtk_file_path_new_dup ("/");
|
||||
+ return gtk_file_path_copy ((GtkFilePath*)volume);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1177,7 +1231,32 @@
|
||||
gtk_file_system_unix_volume_get_display_name (GtkFileSystem *file_system,
|
||||
GtkFileSystemVolume *volume)
|
||||
{
|
||||
- return g_strdup (_("File System")); /* Same as Nautilus */
|
||||
+ gchar * slash;
|
||||
+ gchar * path;
|
||||
+ gchar * c;
|
||||
+
|
||||
+ g_return_val_if_fail (file_system && volume, NULL);
|
||||
+
|
||||
+ path = gtk_file_system_path_to_filename (file_system, (GtkFilePath*) volume);
|
||||
+
|
||||
+ g_return_val_if_fail (path && *path, NULL);
|
||||
+
|
||||
+ if (path[0] == '/' && !path[1])
|
||||
+ return g_strdup (_("Filesystem")); /* Same as Nautilus */
|
||||
+
|
||||
+ /* Now the media volumes */
|
||||
+ /* strip trailing / if any */
|
||||
+ c = g_utf8_prev_char (path + strlen(path));
|
||||
+
|
||||
+ if (*c == '/')
|
||||
+ *c = 0;
|
||||
+
|
||||
+ slash = g_utf8_strrchr (path, -1, '/');
|
||||
+
|
||||
+ if (!slash)
|
||||
+ return g_strdup (path);
|
||||
+
|
||||
+ return g_strdup (slash + 1);
|
||||
}
|
||||
|
||||
static IconType
|
||||
@@ -1265,10 +1344,57 @@
|
||||
GtkFileSystemVolume *volume,
|
||||
GError **error)
|
||||
{
|
||||
- /* FIXME: maybe we just always want to return GTK_STOCK_HARDDISK here?
|
||||
- * or the new tango icon name?
|
||||
- */
|
||||
- return g_strdup ("gnome-dev-harddisk");
|
||||
+ gchar * c;
|
||||
+ gchar * slash;
|
||||
+ gchar * path = NULL;
|
||||
+ GtkFilePath * fpath;
|
||||
+ const gchar * id = NULL;
|
||||
+
|
||||
+ g_return_val_if_fail (file_system && volume, NULL);
|
||||
+
|
||||
+ fpath = gtk_file_system_volume_get_base_path (file_system, volume);
|
||||
+
|
||||
+ if (!fpath)
|
||||
+ goto out;
|
||||
+
|
||||
+ path = gtk_file_system_path_to_filename (file_system, fpath);
|
||||
+ gtk_file_path_free (fpath);
|
||||
+
|
||||
+ if (!path || !*path || (*path == '/' && !path[1]))
|
||||
+ goto out;
|
||||
+
|
||||
+ /* Now the media volumes */
|
||||
+ /* strip trailing / if any */
|
||||
+ c = g_utf8_prev_char (path + strlen(path));
|
||||
+
|
||||
+ if (*c == '/')
|
||||
+ *c = 0;
|
||||
+
|
||||
+ slash = g_utf8_strrchr (path, -1, '/');
|
||||
+
|
||||
+ if (slash)
|
||||
+ {
|
||||
+ slash++;
|
||||
+
|
||||
+ if (!strcmp (slash, "card"))
|
||||
+ id = "gnome-dev-media-sdmmc";
|
||||
+ else if (!strcmp (slash, "cf"))
|
||||
+ id = "gnome-dev-media-cf";
|
||||
+ else if (!strncmp (slash, "mmc", 3))
|
||||
+ id = "gnome-dev-media-sdmmc";
|
||||
+ else if (!strcmp (slash, "usbhdd"))
|
||||
+ id = "gnome-dev-removable-usb";
|
||||
+ else
|
||||
+ id = "gnome-dev-removable";
|
||||
+ }
|
||||
+
|
||||
+ out:
|
||||
+ g_free (path);
|
||||
+
|
||||
+ if (!id)
|
||||
+ id = "gnome-fs-blockdev";
|
||||
+
|
||||
+ return g_strdup (id);
|
||||
}
|
||||
|
||||
static char *
|
||||
@@ -1,7 +1,7 @@
|
||||
require gtk+.inc
|
||||
|
||||
DEPENDS += "cairo"
|
||||
PR = "r12"
|
||||
PR = "r13"
|
||||
|
||||
# disable per default - untested and not all patches included.
|
||||
DEFAULT_PREFERENCE = "-1"
|
||||
@@ -24,12 +24,18 @@ SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.10/gtk+-${PV}.tar.bz2 \
|
||||
file://toggle-font.diff;patch=1;pnum=0 \
|
||||
file://combo-arrow-size.patch;patch=1;pnum=0 \
|
||||
file://range-no-redraw.patch;patch=1;pnum=0 \
|
||||
file://scrolled-placement.patch;patch=1;pnum=0"
|
||||
file://scrolled-placement.patch;patch=1;pnum=0 \
|
||||
# file://scroll-timings.patch;patch=1 \
|
||||
# file://pangoxft2.10.6.diff;patch=1"
|
||||
# file://gtk+-handhelds.patch;patch=1
|
||||
# file://single-click.patch;patch=1
|
||||
# file://spinbutton.patch;patch=1 \
|
||||
file://filesystem-volumes.patch;patch=1\
|
||||
file://filechooser-utils.patch;patch=1\
|
||||
file://filechooser.patch;patch=1\
|
||||
file://filechooser-default.patch;patch=1\
|
||||
file://filechooser-respect-style.patch;patch=1"
|
||||
|
||||
|
||||
EXTRA_OECONF = "--without-libtiff --disable-xkb --disable-glibtest --enable-display-migration"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user