]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkfilechooserbutton.c
Use gtk_separator_new() instead gtk_[v|h]separator_new()
[~andy/gtk] / gtk / gtkfilechooserbutton.c
index 70b0b4f26898325373f2104a2a523a007368bd7b..3b2acc3397ead2de6702faecb28f7713d16ae8c8 100644 (file)
 #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)")
@@ -210,10 +207,8 @@ static void     gtk_file_chooser_button_get_property       (GObject          *ob
                                                            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,
@@ -222,7 +217,6 @@ static void     gtk_file_chooser_button_drag_data_received (GtkWidget        *wi
                                                            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);
@@ -320,11 +314,9 @@ static void
 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;
@@ -332,11 +324,9 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
   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;
@@ -435,7 +425,9 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
   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;
@@ -463,7 +455,7 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
   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);
 
@@ -662,7 +654,7 @@ gtk_file_chooser_button_constructor (GType                  type,
 
       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));
     }
@@ -820,10 +812,6 @@ gtk_file_chooser_button_set_property (GObject      *object,
       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));
@@ -856,7 +844,6 @@ gtk_file_chooser_button_get_property (GObject    *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:
@@ -866,6 +853,7 @@ gtk_file_chooser_button_get_property (GObject    *object,
     case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
     case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
     case GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION:
+    case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
       g_object_get_property (G_OBJECT (priv->dialog), pspec->name, value);
       break;
 
@@ -888,13 +876,13 @@ gtk_file_chooser_button_finalize (GObject *object)
 }
 
 /* ********************* *
- *  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;
@@ -954,14 +942,9 @@ gtk_file_chooser_button_destroy (GtkObject *object)
       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;
@@ -1115,12 +1098,6 @@ gtk_file_chooser_button_show_all (GtkWidget *widget)
   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)
 {
@@ -1585,7 +1562,7 @@ model_free_row_data (GtkFileChooserButton *button,
       g_object_unref (data);
       break;
     case ROW_TYPE_VOLUME:
-      _gtk_file_system_volume_free (data);
+      _gtk_file_system_volume_unref (data);
       break;
     default:
       break;
@@ -1776,11 +1753,16 @@ model_add_volumes (GtkFileChooserButton *button,
              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);
+                }
            }
        }
 
@@ -1795,7 +1777,7 @@ model_add_volumes (GtkFileChooserButton *button,
                          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);
 
@@ -2333,7 +2315,7 @@ update_label_and_image (GtkFileChooserButton *button)
          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;
@@ -2442,13 +2424,13 @@ open_dialog (GtkFileChooserButton *button)
 
   /* 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),
@@ -2732,33 +2714,6 @@ gtk_file_chooser_button_new (const gchar          *title,
                       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
@@ -2916,6 +2871,3 @@ gtk_file_chooser_button_get_focus_on_click (GtkFileChooserButton *button)
   
   return button->priv->focus_on_click;
 }
-
-#define __GTK_FILE_CHOOSER_BUTTON_C__
-#include "gtkaliasdef.c"