#include "gtkfilechooserbutton.h"
#include "gtkprivate.h"
-#include "gtkalias.h"
/* **************** *
* Private Macros *
* **************** */
-#define GTK_FILE_CHOOSER_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_FILE_CHOOSER_BUTTON, GtkFileChooserButtonPrivate))
-
#define DEFAULT_TITLE N_("Select A File")
#define DESKTOP_DISPLAY_NAME N_("Desktop")
#define FALLBACK_DISPLAY_NAME N_("(None)")
GParamSpec *pspec);
static void gtk_file_chooser_button_finalize (GObject *object);
-/* GtkObject Functions */
-static void gtk_file_chooser_button_destroy (GtkObject *object);
-
/* GtkWidget Functions */
+static void gtk_file_chooser_button_destroy (GtkWidget *widget);
static void gtk_file_chooser_button_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
guint type,
guint drag_time);
static void gtk_file_chooser_button_show_all (GtkWidget *widget);
-static void gtk_file_chooser_button_hide_all (GtkWidget *widget);
static void gtk_file_chooser_button_show (GtkWidget *widget);
static void gtk_file_chooser_button_hide (GtkWidget *widget);
static void gtk_file_chooser_button_map (GtkWidget *widget);
gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
{
GObjectClass *gobject_class;
- GtkObjectClass *gtkobject_class;
GtkWidgetClass *widget_class;
gobject_class = G_OBJECT_CLASS (class);
- gtkobject_class = GTK_OBJECT_CLASS (class);
widget_class = GTK_WIDGET_CLASS (class);
gobject_class->constructor = gtk_file_chooser_button_constructor;
gobject_class->get_property = gtk_file_chooser_button_get_property;
gobject_class->finalize = gtk_file_chooser_button_finalize;
- gtkobject_class->destroy = gtk_file_chooser_button_destroy;
-
+ widget_class->destroy = gtk_file_chooser_button_destroy;
widget_class->drag_data_received = gtk_file_chooser_button_drag_data_received;
widget_class->show_all = gtk_file_chooser_button_show_all;
- widget_class->hide_all = gtk_file_chooser_button_hide_all;
widget_class->show = gtk_file_chooser_button_show;
widget_class->hide = gtk_file_chooser_button_hide;
widget_class->map = gtk_file_chooser_button_map;
GtkWidget *box, *image, *sep;
GtkTargetList *target_list;
- priv = button->priv = GTK_FILE_CHOOSER_BUTTON_GET_PRIVATE (button);
+ priv = button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button,
+ GTK_TYPE_FILE_CHOOSER_BUTTON,
+ GtkFileChooserButtonPrivate);
priv->icon_size = FALLBACK_ICON_SIZE;
priv->focus_on_click = TRUE;
gtk_container_add (GTK_CONTAINER (box), priv->label);
gtk_widget_show (priv->label);
- sep = gtk_vseparator_new ();
+ sep = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX (box), sep, FALSE, FALSE, 0);
gtk_widget_show (sep);
gtk_file_chooser_button_set_title (button, _(DEFAULT_TITLE));
}
- else if (!GTK_WINDOW (priv->dialog)->title)
+ else if (!gtk_window_get_title (GTK_WINDOW (priv->dialog)))
{
gtk_file_chooser_button_set_title (button, _(DEFAULT_TITLE));
}
fs_bookmarks_changed_cb (priv->fs, button);
break;
- case GTK_FILE_CHOOSER_PROP_FILE_SYSTEM_BACKEND:
- /* Ignore property */
- break;
-
case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
g_warning ("%s: Choosers of type `%s` do not support selecting multiple files.",
G_STRFUNC, G_OBJECT_TYPE_NAME (object));
case PROP_TITLE:
case GTK_FILE_CHOOSER_PROP_ACTION:
- case GTK_FILE_CHOOSER_PROP_FILE_SYSTEM_BACKEND:
case GTK_FILE_CHOOSER_PROP_FILTER:
case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY:
case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET:
}
/* ********************* *
- * GtkObject Functions *
+ * GtkWidget Functions *
* ********************* */
static void
-gtk_file_chooser_button_destroy (GtkObject *object)
+gtk_file_chooser_button_destroy (GtkWidget *widget)
{
- GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (object);
+ GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
GtkFileChooserButtonPrivate *priv = button->priv;
GtkTreeIter iter;
GSList *l;
priv->fs = NULL;
}
- GTK_OBJECT_CLASS (gtk_file_chooser_button_parent_class)->destroy (object);
+ GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->destroy (widget);
}
-
-/* ********************* *
- * GtkWidget Functions *
- * ********************* */
-
struct DndSelectFolderData
{
GtkFileSystem *file_system;
gtk_widget_show (widget);
}
-static void
-gtk_file_chooser_button_hide_all (GtkWidget *widget)
-{
- gtk_widget_hide (widget);
-}
-
static void
gtk_file_chooser_button_show (GtkWidget *widget)
{
g_object_unref (data);
break;
case ROW_TYPE_VOLUME:
- _gtk_file_system_volume_free (data);
+ _gtk_file_system_volume_unref (data);
break;
default:
break;
GFile *base_file;
base_file = _gtk_file_system_volume_get_root (volume);
- if (base_file != NULL && !g_file_is_native (base_file))
- {
- _gtk_file_system_volume_free (volume);
- continue;
- }
+ if (base_file != NULL)
+ {
+ if (!g_file_is_native (base_file))
+ {
+ g_object_unref (base_file);
+ continue;
+ }
+ else
+ g_object_unref (base_file);
+ }
}
}
ICON_COLUMN, pixbuf,
DISPLAY_NAME_COLUMN, display_name,
TYPE_COLUMN, ROW_TYPE_VOLUME,
- DATA_COLUMN, volume,
+ DATA_COLUMN, _gtk_file_system_volume_ref (volume),
IS_FOLDER_COLUMN, TRUE,
-1);
if (base_file)
g_object_unref (base_file);
- _gtk_file_system_volume_free (volume);
+ _gtk_file_system_volume_unref (volume);
if (label_text)
goto out;
/* Setup the dialog parent to be chooser button's toplevel, and be modal
as needed. */
- if (!GTK_WIDGET_VISIBLE (priv->dialog))
+ if (!gtk_widget_get_visible (priv->dialog))
{
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
- if (GTK_WIDGET_TOPLEVEL (toplevel) && GTK_IS_WINDOW (toplevel))
+ if (gtk_widget_is_toplevel (toplevel) && GTK_IS_WINDOW (toplevel))
{
if (GTK_WINDOW (toplevel) != gtk_window_get_transient_for (GTK_WINDOW (priv->dialog)))
gtk_window_set_transient_for (GTK_WINDOW (priv->dialog),
NULL);
}
-/**
- * gtk_file_chooser_button_new_with_backend:
- * @title: the title of the browse dialog.
- * @action: the open mode for the widget.
- * @backend: the name of the #GtkFileSystem backend to use.
- *
- * Creates a new file-selecting button widget using @backend.
- *
- * Returns: a new button widget.
- *
- * Since: 2.6
- * Deprecated: 2.14: Use gtk_file_chooser_button_new() instead.
- **/
-GtkWidget *
-gtk_file_chooser_button_new_with_backend (const gchar *title,
- GtkFileChooserAction action,
- const gchar *backend)
-{
- g_return_val_if_fail (action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, NULL);
-
- return g_object_new (GTK_TYPE_FILE_CHOOSER_BUTTON,
- "action", action,
- "title", (title ? title : _(DEFAULT_TITLE)),
- NULL);
-}
-
/**
* gtk_file_chooser_button_new_with_dialog:
* @dialog: the widget to use as dialog
return button->priv->focus_on_click;
}
-
-#define __GTK_FILE_CHOOSER_BUTTON_C__
-#include "gtkaliasdef.c"