Beispiel #1
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);
}
Beispiel #2
0
static void
gdl_dock_object_set_property  (GObject      *g_object,
                               guint         prop_id,
                               const GValue *value,
                               GParamSpec   *pspec)
{
    GdlDockObject *object = GDL_DOCK_OBJECT (g_object);

    switch (prop_id) {
    case PROP_NAME:
        gdl_dock_object_set_name (object, g_value_get_string (value));
        break;
    case PROP_LONG_NAME:
        gdl_dock_object_set_long_name (object, g_value_get_string (value));
        break;
    case PROP_STOCK_ID:
        gdl_dock_object_set_stock_id (object, g_value_get_string (value));
        break;
    case PROP_PIXBUF_ICON:
        gdl_dock_object_set_pixbuf (object,  g_value_get_pointer (value));
        break;
    case PROP_MASTER:
        if (g_value_get_object (value))
            gdl_dock_object_bind (object, g_value_get_object (value));
        else
            gdl_dock_object_unbind (object);
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
    }
}
static void
gdl_dock_master_dispose (GObject *g_object)
{
    GdlDockMaster *master;
    
    g_return_if_fail (GDL_IS_DOCK_MASTER (g_object));

    master = GDL_DOCK_MASTER (g_object);

    if (master->toplevel_docks) {
        g_list_foreach (master->toplevel_docks,
                        (GFunc) gdl_dock_object_unbind, NULL);
        g_list_free (master->toplevel_docks);
        master->toplevel_docks = NULL;
    }
    
    if (master->dock_objects) {
        GSList *alive_docks = NULL;
        g_hash_table_foreach (master->dock_objects,
                              (GHFunc) ht_foreach_build_slist, &alive_docks);
        while (alive_docks) {
            gdl_dock_object_unbind (GDL_DOCK_OBJECT (alive_docks->data));
            alive_docks = g_slist_delete_link (alive_docks, alive_docks);
        }
        
        g_hash_table_destroy (master->dock_objects);
        master->dock_objects = NULL;
    }
    
    if (master->_priv) {
        if (master->_priv->idle_layout_changed_id)
            g_source_remove (master->_priv->idle_layout_changed_id);
        
        if (master->_priv->root_xor_gc) {
            g_object_unref (master->_priv->root_xor_gc);
            master->_priv->root_xor_gc = NULL;
        }
        if (master->_priv->drag_request) {
            if (G_IS_VALUE (&master->_priv->drag_request->extra))
                g_value_unset (&master->_priv->drag_request->extra);
            g_free (master->_priv->drag_request);
            master->_priv->drag_request = NULL;
        }
        g_free (master->_priv->default_title);
        master->_priv->default_title = NULL;

        g_hash_table_destroy (master->_priv->locked_items);
        master->_priv->locked_items = NULL;
        g_hash_table_destroy (master->_priv->unlocked_items);
        master->_priv->unlocked_items = NULL;
        
        g_free (master->_priv);
        master->_priv = NULL;
    }

    GDL_CALL_PARENT (G_OBJECT_CLASS, dispose, (g_object));
}