Esempio n. 1
0
/**
 * gdl_dock_object_get_controller:
 * @object: a #GdlDockObject
 *
 * Retrieves the controller of the object.
 *
 * Return value: (transfer none): a #GdlDockObject object
 *
 * Since: 3.6
 */
GdlDockObject *
gdl_dock_object_get_controller (GdlDockObject *object)
{
    g_return_val_if_fail (GDL_IS_DOCK_OBJECT (object), NULL);

    return gdl_dock_master_get_controller (GDL_DOCK_MASTER (object->priv->master));
}
Esempio n. 2
0
/**
 * gdl_dock_object_get_pixbuf:
 * @object: a #GdlDockObject
 *
 * Retrieves a pixbuf used as the dock object icon.
 *
 * Return value: (transfer none): icon for dock object
 *
 * Since: 3.6
 */
GdkPixbuf *
gdl_dock_object_get_pixbuf (GdlDockObject *object)
{
    g_return_val_if_fail (GDL_IS_DOCK_OBJECT (object), NULL);

    return object->priv->pixbuf_icon;
}
Esempio n. 3
0
/**
 * gdl_dock_object_get_stock_id:
 * @object: a #GdlDockObject
 *
 * Retrieves the a stock id used as the object icon.
 *
 * Return value: A stock id corresponding to the object icon.
 *
 * Since: 3.6
 */
const gchar *
gdl_dock_object_get_stock_id (GdlDockObject *object)
{
    g_return_val_if_fail (GDL_IS_DOCK_OBJECT (object), NULL);

    return object->priv->stock_id;
}
Esempio n. 4
0
/**
 * gdl_dock_object_get_long_name:
 * @object: a #GdlDockObject
 *
 * Retrieves the long name of the object. This name is an human readable string
 * which can be displayed in the user interface.
 *
 * Return value: the name of the object.
 *
 * Since: 3.6
 */
const gchar *
gdl_dock_object_get_long_name (GdlDockObject *object)
{
    g_return_val_if_fail (GDL_IS_DOCK_OBJECT (object), NULL);

    return object->priv->long_name;
}
Esempio n. 5
0
/**
 * gdl_dock_object_get_master:
 * @object: a #GdlDockObject
 *
 * Retrieves the master of the object.
 *
 * Return value: (transfer none): a #GdlDockMaster object
 *
 * Since: 3.6
 */
GObject *
gdl_dock_object_get_master (GdlDockObject *object)
{
    g_return_val_if_fail (GDL_IS_DOCK_OBJECT (object), NULL);

    return object->priv->master;
}
Esempio n. 6
0
/**
 * gdl_dock_object_is_automatic:
 * @object: a #GdlDockObject
 *
 * Determine if an object is managed by the dock master, such object is
 * destroyed automatically when it is not needed anymore.
 *
 * Return value: %TRUE if the object is managed automatically by the dock master.
 *
 * Since: 3.6
 */
gboolean
gdl_dock_object_is_automatic (GdlDockObject *object)
{
    g_return_val_if_fail (GDL_IS_DOCK_OBJECT (object), FALSE);

    return object->priv->automatic;
}
Esempio n. 7
0
/**
 * gdl_dock_object_set_manual:
 * @object: a #GdlDockObject
 *
 * A #GdlDockObject is managed by default by the dock master, use this function
 * to make it a manual object if you want to manage the destruction of the
 * object.
 *
 * Since: 3.6
 */
void
gdl_dock_object_set_manual (GdlDockObject *object)
{
    g_return_if_fail (GDL_IS_DOCK_OBJECT (object));

    object->priv->automatic = FALSE;
}
Esempio n. 8
0
static void
gdl_dock_object_destroy (GtkWidget *dock_object)
{
    GdlDockObject *object;

    g_return_if_fail (GDL_IS_DOCK_OBJECT (dock_object));

    object = GDL_DOCK_OBJECT (dock_object);
    if (gdl_dock_object_is_compound (object)) {
        /* detach our dock object children if we have some, and even
           if we are not attached, so they can get notification */
        gdl_dock_object_freeze (object);
        gtk_container_foreach (GTK_CONTAINER (object),
                               (GtkCallback) gdl_dock_object_foreach_detach,
                               NULL);
        object->priv->reduce_pending = FALSE;
        gdl_dock_object_thaw (object);
    }
    /* detach ourselves */
    gdl_dock_object_detach (object, FALSE);

    /* finally unbind us */
    if (object->priv->master)
        gdl_dock_object_unbind (object);

    GTK_WIDGET_CLASS(gdl_dock_object_parent_class)->destroy (dock_object);
}
Esempio n. 9
0
/**
 * gdl_dock_object_is_frozen:
 * @object: A #GdlDockObject
 *
 * Determine if an object is frozen and is not removed immediately from the
 * widget hierarchy when it is reduced.
 *
 * Return value: %TRUE if the object is frozen.
 *
 * Since: 3.6
 */
gboolean
gdl_dock_object_is_frozen (GdlDockObject *object)
{
    g_return_val_if_fail (GDL_IS_DOCK_OBJECT (object), FALSE);

    return object->priv->freeze_count > 0;
}
Esempio n. 10
0
/**
 * gdl_dock_object_is_compound:
 * @object: A #GdlDockObject
 *
 * Check if an object is a compound object, accepting children widget or not.
 *
 * Returns: %TRUE if @object is a compound object.
 */
gboolean
gdl_dock_object_is_compound (GdlDockObject *object)
{
    g_return_val_if_fail (object != NULL, FALSE);
    g_return_val_if_fail (GDL_IS_DOCK_OBJECT (object), FALSE);

    return GDL_DOCK_OBJECT_GET_CLASS (object)->priv->is_compound;
}
Esempio n. 11
0
/**
 * gdl_dock_object_set_pixbuf:
 * @object: a #GdlDockObject
 * @icon: (allow-none): a icon or %NULL
 *
 * Set a icon for a dock object using a #GdkPixbuf.
 *
 * Since: 3.6
 */
void
gdl_dock_object_set_pixbuf (GdlDockObject *object,
                            GdkPixbuf *icon)
{
    g_return_if_fail (GDL_IS_DOCK_OBJECT (object));
    g_return_if_fail (icon == NULL || GDK_IS_PIXBUF (icon));

    object->priv->pixbuf_icon =icon;
}
Esempio n. 12
0
/**
 * gdl_dock_object_set_stock_id:
 * @object: a #GdlDockObject
 * @stock_id: a stock id
 *
 * Set an icon for the dock object using a stock id.
 *
 * Since: 3.6
 */
void
gdl_dock_object_set_stock_id (GdlDockObject *object,
                              const gchar *stock_id)
{
    g_return_if_fail (GDL_IS_DOCK_OBJECT (object));

    g_free (object->priv->stock_id);
    object->priv->stock_id = g_strdup (stock_id);
}
Esempio n. 13
0
/**
 * gdl_dock_object_set_long_name:
 * @object: a #GdlDockObject
 * @name: a name for the object
 *
 * Set the long name of the object. This name is an human readable string
 * which can be displayed in the user interface.
 *
 * Since: 3.6
 */
void
gdl_dock_object_set_long_name (GdlDockObject *object,
                               const gchar *name)
{
    g_return_if_fail (GDL_IS_DOCK_OBJECT (object));

    g_free (object->priv->long_name);
    object->priv->long_name = g_strdup (name);
}
Esempio n. 14
0
/**
 * gdl_dock_object_set_stock_id:
 * @object: a #GdlDockObject
 * @stock_id: a stock id
 *
 * Set an icon for the dock object using a stock id.
 *
 * Since: 3.6
 */
void
gdl_dock_object_set_stock_id (GdlDockObject *object,
                              const gchar *stock_id)
{
    g_return_if_fail (GDL_IS_DOCK_OBJECT (object));

    g_free (object->priv->stock_id);
    object->priv->stock_id = g_strdup (stock_id);

    g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_STOCK_ID]);
}
Esempio n. 15
0
gboolean
gdl_dock_object_is_compound (GdlDockObject *object)
{
    GdlDockObjectClass *klass;

    g_return_val_if_fail (object != NULL, FALSE);
    g_return_val_if_fail (GDL_IS_DOCK_OBJECT (object), FALSE);

    klass = GDL_DOCK_OBJECT_GET_CLASS (object);
    return klass->is_compound;
}
Esempio n. 16
0
/**
 * gdl_dock_object_set_long_name:
 * @object: a #GdlDockObject
 * @name: a name for the object
 *
 * Set the long name of the object. This name is an human readable string
 * which can be displayed in the user interface.
 *
 * Since: 3.6
 */
void
gdl_dock_object_set_long_name (GdlDockObject *object,
                               const gchar *name)
{
    g_return_if_fail (GDL_IS_DOCK_OBJECT (object));

    g_free (object->priv->long_name);
    object->priv->long_name = g_strdup (name);

    g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_LONG_NAME]);
}
Esempio n. 17
0
/**
 * gdl_dock_object_set_pixbuf:
 * @object: a #GdlDockObject
 * @icon: (allow-none): a icon or %NULL
 *
 * Set a icon for a dock object using a #GdkPixbuf.
 *
 * Since: 3.6
 */
void
gdl_dock_object_set_pixbuf (GdlDockObject *object,
                            GdkPixbuf *icon)
{
    g_return_if_fail (GDL_IS_DOCK_OBJECT (object));
    g_return_if_fail (icon == NULL || GDK_IS_PIXBUF (icon));

    object->priv->pixbuf_icon =icon;

    g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_PIXBUF_ICON]);
}
Esempio n. 18
0
/**
 * gdl_dock_object_get_parent_object:
 * @object: A #GdlDockObject
 *
 * Returns a parent #GdlDockObject if it exists.
 *
 * Returns: (allow-none) (transfer none): a #GdlDockObject or %NULL if such object does not exist.
 */
GdlDockObject *
gdl_dock_object_get_parent_object (GdlDockObject *object)
{
    GtkWidget *parent;

    g_return_val_if_fail (object != NULL, NULL);

    parent = gtk_widget_get_parent (GTK_WIDGET (object));
    while (parent && !GDL_IS_DOCK_OBJECT (parent)) {
        parent = gtk_widget_get_parent (parent);
    }

    return parent ? GDL_DOCK_OBJECT (parent) : NULL;
}
Esempio n. 19
0
void 
gdl_dock_object_present (GdlDockObject *object,
                         GdlDockObject *child)
{
    GdlDockObject *parent;
    
    g_return_if_fail (object != NULL && GDL_IS_DOCK_OBJECT (object));

    parent = gdl_dock_object_get_parent_object (object);
    if (parent)
        /* chain the call to our parent */
        gdl_dock_object_present (parent, object);

    GDL_CALL_VIRTUAL (object, GDL_DOCK_OBJECT_GET_CLASS, present, (object, child));
}
Esempio n. 20
0
static void 
item_detach_cb (GdlDockObject *object,
                gboolean       recursive,
                gpointer       user_data)
{
    GdlDockMaster *master = user_data;
    
    g_return_if_fail (object && GDL_IS_DOCK_OBJECT (object));
    g_return_if_fail (master && GDL_IS_DOCK_MASTER (master));

    if (!GDL_DOCK_OBJECT_IN_REFLOW (object) &&
        !GDL_DOCK_OBJECT_AUTOMATIC (object)) {
        if (!master->_priv->idle_layout_changed_id)
            master->_priv->idle_layout_changed_id =
                g_idle_add (idle_emit_layout_changed, master);
    }
}
Esempio n. 21
0
/**
 * gdl_dock_object_detach:
 * @object: A #GdlDockObject
 * @recursive: %TRUE to detach children
 *
 * Dissociate a dock object from its parent, including or not its children.
 */
void
gdl_dock_object_detach (GdlDockObject *object,
                        gboolean       recursive)
{
    g_return_if_fail (object != NULL);

    if (!GDL_IS_DOCK_OBJECT (object))
        return;

    if (!object->priv->attached && (gtk_widget_get_parent (GTK_WIDGET (object)) == NULL))
        return;

    /* freeze the object to avoid reducing while detaching children */
    gdl_dock_object_freeze (object);
    g_signal_emit (object, gdl_dock_object_signals [DETACH], 0, recursive);
    gdl_dock_object_thaw (object);
}
Esempio n. 22
0
static void
gdl_dock_object_finalize (GObject *g_object)
{
    GdlDockObject *object;
    
    g_return_if_fail (g_object != NULL && GDL_IS_DOCK_OBJECT (g_object));

    object = GDL_DOCK_OBJECT (g_object);

    g_free (object->name);
    object->name = NULL;
    g_free (object->long_name);
    object->long_name = NULL;
    g_free (object->stock_id);
    object->stock_id = NULL;

    GDL_CALL_PARENT (G_OBJECT_CLASS, finalize, (g_object));
}
Esempio n. 23
0
static void
gdl_dock_object_finalize (GObject *g_object)
{
    GdlDockObject *object;
    
    g_return_if_fail (g_object != NULL && GDL_IS_DOCK_OBJECT (g_object));

    object = GDL_DOCK_OBJECT (g_object);

    g_free (object->name);
    object->name = NULL;
    g_free (object->long_name);
    object->long_name = NULL;
    g_free (object->stock_id);
    object->stock_id = NULL;
    object->pixbuf_icon = NULL;

    G_OBJECT_CLASS (gdl_dock_object_parent_class)->finalize (g_object);
}
Esempio n. 24
0
void
gdl_dock_object_detach (GdlDockObject *object,
                        gboolean       recursive)
{
    g_return_if_fail (object != NULL);

    if (!GDL_IS_DOCK_OBJECT (object))
        return;
    
    if (!GDL_DOCK_OBJECT_ATTACHED (object))
        return;
    
    /* freeze the object to avoid reducing while detaching children */
    gdl_dock_object_freeze (object);
    GDL_DOCK_OBJECT_SET_FLAGS (object, GDL_DOCK_IN_DETACH);
    g_signal_emit (object, gdl_dock_object_signals [DETACH], 0, recursive);
    GDL_DOCK_OBJECT_UNSET_FLAGS (object, GDL_DOCK_IN_DETACH);
    gdl_dock_object_thaw (object);
}
Esempio n. 25
0
static void 
item_dock_cb (GdlDockObject    *object,
              GdlDockObject    *requestor,
              GdlDockPlacement  position,
              GValue           *other_data,
              gpointer          user_data)
{
    GdlDockMaster *master = user_data;
    
    g_return_if_fail (requestor && GDL_IS_DOCK_OBJECT (requestor));
    g_return_if_fail (master && GDL_IS_DOCK_MASTER (master));

    /* here we are in fact interested in the requestor, since it's
     * assumed that object will not change its visibility... for the
     * requestor, however, could mean that it's being shown */
    if (!GDL_DOCK_OBJECT_IN_REFLOW (requestor) &&
        !GDL_DOCK_OBJECT_AUTOMATIC (requestor)) {
        if (!master->_priv->idle_layout_changed_id)
            master->_priv->idle_layout_changed_id =
                g_idle_add (idle_emit_layout_changed, master);
    }
}
Esempio n. 26
0
static void
gdl_dock_object_real_reduce (GdlDockObject *object)
{
    GdlDockObject *parent;
    GList         *children;

    g_return_if_fail (object != NULL);

    if (!gdl_dock_object_is_compound (object))
        return;

    parent = gdl_dock_object_get_parent_object (object);
    children = gtk_container_get_children (GTK_CONTAINER (object));
    if (g_list_length (children) <= 1) {
        GList *l;
        GList *dchildren = NULL;

        /* detach ourselves and then re-attach our children to our
           current parent.  if we are not currently attached, the
           children are detached */
        if (parent)
            gdl_dock_object_freeze (parent);
        gdl_dock_object_freeze (object);
        /* Detach the children before detaching this object, since in this
         * way the children can have access to the whole object hierarchy.
         * Set the InDetach flag now, so the children know that this object
         * is going to be detached. */


        for (l = children; l; l = l->next) {
            GdlDockObject *child;

            if (!GDL_IS_DOCK_OBJECT (l->data))
                continue;

            child = GDL_DOCK_OBJECT (l->data);

            g_object_ref (child);
            gdl_dock_object_detach (child, FALSE);
            if (parent)
                dchildren = g_list_append (dchildren, child);
        }
        /* Now it can be detached */
        gdl_dock_object_detach (object, FALSE);

        /* After detaching the reduced object, we can add the
        children (the only child in fact) to the new parent */
        for (l = dchildren; l; l = l->next) {
            gtk_container_add (GTK_CONTAINER (parent), l->data);
            g_object_unref (l->data);
        }
        g_list_free (dchildren);


        /* sink the widget, so any automatic floating widget is destroyed */
        g_object_ref_sink (object);
        /* don't reenter */
        object->priv->reduce_pending = FALSE;
        gdl_dock_object_thaw (object);
        if (parent)
            gdl_dock_object_thaw (parent);
    }
    g_list_free (children);
}