Factor more stuff out into GTK hackery. Fix headers to sync up with the

* nautilus-installer/src/Makefile:
	* nautilus-installer/src/callbacks.c: (ask_to_delete_rpms),
	(ask_are_you_sure):
	* nautilus-installer/src/gtk-hackery.c: (log_debug), (gtk_box_nth),
	(gnome_reply_callback):
	* nautilus-installer/src/installer.c:
	(get_detailed_errors_foreach):
	* nautilus-installer/src/installer.h:
	* nautilus-installer/src/main.c:

	Factor more stuff out into GTK hackery.  Fix headers to sync up
	with the better libtrilobite layout and to follow the moving
	target that is libeazelinstall.

	* nautilus-installer/src/package-tree.c:
	(package_customizer_finalize), (package_customizer_unref),
	(package_customizer_class_initialize),
	(package_customizer_initialize), (package_customizer_new),
	(package_customizer_get_type), (package_info_compare),
	(package_customizer_find_package), (popup_package_dialog),
	(package_customizer_recompute_bongs), (package_toggled),
	(package_customizer_fill), (normalize_labels),
	(package_customizer_set_package_list),
	(package_customizer_get_widget), (jump_to_package_tree_page):
	* nautilus-installer/src/package-tree.h:

	Make the package tree into a proper GTK object.
This commit is contained in:
Robey Pointer 2000-12-15 09:14:37 +00:00
parent 363626d3f1
commit f2634723e4
7 changed files with 285 additions and 106 deletions

View file

@ -25,33 +25,11 @@
#endif
#include <gnome.h>
#include "callbacks.h"
#include "support.h"
#include "installer.h"
extern int installer_debug;
/* better than a macro, and uses our nice logging system */
static void
log_debug (const gchar *format, ...)
{
va_list args;
if (installer_debug) {
va_start (args, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args);
va_end (args);
}
}
/* do what gnome ought to do automatically */
static void
reply_callback (int reply, gboolean *answer)
{
*answer = (reply == 0);
}
static void
ask_to_delete_rpms (EazelInstaller *installer)
@ -66,10 +44,10 @@ ask_to_delete_rpms (EazelInstaller *installer)
"The package files are stored in %s"), installer->tmpdir);
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (installer->druid));
if (GTK_IS_WINDOW (toplevel)) {
dialog = gnome_question_dialog_parented (message, (GnomeReplyCallback)reply_callback,
dialog = gnome_question_dialog_parented (message, (GnomeReplyCallback)gnome_reply_callback,
&answer, GTK_WINDOW (toplevel));
} else {
dialog = gnome_question_dialog (message, (GnomeReplyCallback)reply_callback, &answer);
dialog = gnome_question_dialog (message, (GnomeReplyCallback)gnome_reply_callback, &answer);
}
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
@ -93,10 +71,10 @@ ask_are_you_sure (EazelInstaller *installer)
message = _("Cancel the installation:\nAre you sure?");
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (installer->druid));
if (GTK_IS_WINDOW (toplevel)) {
dialog = gnome_question_dialog_parented (message, (GnomeReplyCallback)reply_callback,
dialog = gnome_question_dialog_parented (message, (GnomeReplyCallback)gnome_reply_callback,
&answer, GTK_WINDOW (toplevel));
} else {
dialog = gnome_question_dialog (message, (GnomeReplyCallback)reply_callback, &answer);
dialog = gnome_question_dialog (message, (GnomeReplyCallback)gnome_reply_callback, &answer);
}
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));

View file

@ -32,11 +32,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <gnome.h>
#include "installer.h"
extern int installer_debug;
/* better than a macro, and uses our nice logging system */
void
log_debug (const gchar *format, ...)
{
va_list args;
if (installer_debug) {
va_start (args, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args);
va_end (args);
}
}
void
get_pixmap_width_height (char **xpmdata, int *width, int *height)
{
@ -160,3 +176,10 @@ gtk_box_nth (GtkWidget *box, int n)
child = (GtkBoxChild *)(g_list_nth (GTK_BOX (box)->children, n)->data);
return GTK_WIDGET (child->widget);
}
/* do what gnome ought to do automatically */
void
gnome_reply_callback (int reply, gboolean *answer)
{
*answer = (reply == 0);
}

View file

@ -31,8 +31,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <libtrilobite/helixcode-utils.h>
#include <libtrilobite/trilobite-core-utils.h>
#include <libtrilobite/trilobite-core-network.h>
#include <eazel-install-xml-package-list.h>
#include <eazel-install-protocols.h>
#include <eazel-install-query.h>
@ -50,6 +49,7 @@
#include <nautilus-druid-page-eazel.h>
#include "installer.h"
#include "package-tree.h"
#include "callbacks.h"
#include "support.h"
#include "proxy.h"
@ -186,20 +186,6 @@ static void jump_to_error_page (EazelInstaller *installer, GList *bullets, char
static GtkObjectClass *eazel_installer_parent_class;
/* better than a macro, and uses our nice logging system */
static void
log_debug (const gchar *format, ...)
{
va_list args;
if (installer_debug) {
va_start (args, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args);
va_end (args);
}
}
static void
start_over (EazelInstaller *installer)
{
@ -904,7 +890,7 @@ get_detailed_errors_foreach (PackageData *pack, GetErrorsForEachData *data)
cat = (CategoryData *)iter->data;
for (iter2 = cat->packages; iter2 ; iter2 = g_list_next (iter2)) {
pack_in = (PackageData *)iter2->data;
trilobite_debug ("pack->name = %s, pack_in->name = %s", pack->name, pack_in->name);
log_debug ("pack->name = %s, pack_in->name = %s", pack->name, pack_in->name);
if (strcmp (pack->name, pack_in->name) == 0) {
g_message ("bad mojo: cannot open package %s", pack->name);
distro = trilobite_get_distribution_name (trilobite_get_distribution (),

View file

@ -98,10 +98,8 @@ void eazel_installer_do_install (EazelInstaller *installer,
gboolean remove);
void eazel_installer_post_install (EazelInstaller *installer);
/* package-tree.c */
void jump_to_package_tree_page (EazelInstaller *installer, GList *packages);
/* gtk-hackery.c */
void log_debug (const gchar *format, ...);
void get_pixmap_width_height (char **xpmdata, int *width, int *height);
GdkPixbuf *create_pixmap (GtkWidget *widget, char **xpmdata);
GtkWidget *create_gtk_pixmap (GtkWidget *widget, char **xpmdata);
@ -110,6 +108,7 @@ void gtk_label_set_color (GtkWidget *label, guint32 rgb);
void gtk_box_add_padding (GtkWidget *box, int pad_x, int pad_y);
GtkWidget *gtk_label_as_hbox (GtkWidget *label);
GtkWidget *gtk_box_nth (GtkWidget *box, int n);
void gnome_reply_callback (int reply, gboolean *answer);
#ifdef __cplusplus
}

View file

@ -28,6 +28,8 @@
#define BUILD_DATE "unknown"
#endif
#include <unistd.h>
#include <sys/stat.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/vfs.h>
@ -36,7 +38,7 @@
#include "installer.h"
#include "support.h"
#include "callbacks.h"
#include <libtrilobite/helixcode-utils.h>
#include <libtrilobite/trilobite-core-network.h>
extern int installer_debug;
extern int installer_spam;

View file

@ -33,6 +33,7 @@
#include <nautilus-druid.h>
#include <nautilus-druid-page-eazel.h>
#include "installer.h"
#include "package-tree.h"
/* pixmaps */
#include "bootstrap-background.xpm"
@ -44,10 +45,7 @@
#define RGB_RED 0xFF0000
#define FONT_TITLE _("-adobe-helvetica-bold-r-normal-*-14-*-*-*-p-*-*-*,*-r-*")
typedef struct _packageinfo PackageInfo;
typedef struct _packagecustomizer PackageCustomizer;
/* private */
typedef enum {
INSTALL_GROUP = 1,
UPGRADE_GROUP,
@ -55,7 +53,7 @@ typedef enum {
} PackageGroup;
/* item in package list */
struct _packageinfo {
typedef struct {
PackageData *package;
PackageCustomizer *table;
GtkWidget *checkbox;
@ -66,12 +64,11 @@ struct _packageinfo {
gboolean show_bong;
PackageGroup group;
char *version; /* upgraded or downgraded from */
};
} PackageInfo;
struct _packagecustomizer {
struct _PackageCustomizerPrivate {
GList *packages; /* GList<PackageInfo *> */
GList *package_tree; /* original package tree */
GtkWidget *druid_page;
GtkWidget *hbox_install;
GtkWidget *hbox_upgrade;
GtkWidget *hbox_downgrade;
@ -83,6 +80,112 @@ struct _packagecustomizer {
};
static GtkWidget *category_hbox_new (void);
/********** GTK object crap **********/
/* This is the parent class pointer */
static GtkObjectClass *package_customizer_parent_class;
static void
package_customizer_finalize (GtkObject *object)
{
PackageCustomizerPrivate *private;
g_return_if_fail (object != NULL);
g_return_if_fail (IS_PACKAGE_CUSTOMIZER (object));
private = PACKAGE_CUSTOMIZER (object)->private;
g_list_free (private->packages);
/* hbox's are owned by the top vbox, so that's all that needs to be dropped */
gtk_widget_unref (private->vbox);
g_free (private);
PACKAGE_CUSTOMIZER (object)->private = NULL;
if (GTK_OBJECT_CLASS (package_customizer_parent_class)->finalize) {
GTK_OBJECT_CLASS (package_customizer_parent_class)->finalize (object);
}
log_debug ("<= package customizer finalize");
}
void
package_customizer_unref (GtkObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (IS_PACKAGE_CUSTOMIZER (object));
gtk_object_unref (object);
}
static void
package_customizer_class_initialize (PackageCustomizerClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *)klass;
package_customizer_parent_class = gtk_type_class (gtk_object_get_type ());
object_class->finalize = package_customizer_finalize;
}
static void
package_customizer_initialize (PackageCustomizer *object)
{
g_assert (object != NULL);
g_assert (IS_PACKAGE_CUSTOMIZER (object));
log_debug ("=> package customizer create");
object->private = g_new0 (PackageCustomizerPrivate, 1);
/* setup widgets */
object->private->hbox_install = category_hbox_new ();
object->private->hbox_upgrade = category_hbox_new ();
object->private->hbox_downgrade = category_hbox_new ();
object->private->vbox = gtk_vbox_new (FALSE, 0);
}
PackageCustomizer *
package_customizer_new (void)
{
PackageCustomizer *object;
object = PACKAGE_CUSTOMIZER (gtk_object_new (TYPE_PACKAGE_CUSTOMIZER, NULL));
gtk_object_ref (GTK_OBJECT (object));
gtk_object_sink (GTK_OBJECT (object));
return object;
}
GtkType
package_customizer_get_type (void)
{
static GtkType my_type = 0;
if (my_type == 0) {
static const GtkTypeInfo my_info = {
"PackageCustomizer",
sizeof (PackageCustomizer),
sizeof (PackageCustomizerClass),
(GtkClassInitFunc) package_customizer_class_initialize,
(GtkObjectInitFunc) package_customizer_initialize,
NULL,
NULL,
(GtkClassInitFunc) NULL,
};
my_type = gtk_type_unique (gtk_object_get_type (), &my_info);
}
return my_type;
}
/********** helper functions **********/
/* figure out what group this package belongs to -- if version is non-NULL, the previous version is filled in */
static PackageGroup
@ -140,7 +243,7 @@ find_package_parents (PackageData *package, GList *packlist, GList *sofar)
}
static int
package_customizer_compare (PackageInfo *info, PackageData *package)
package_info_compare (PackageInfo *info, PackageData *package)
{
return (info->package == package) ? 0 : 1;
}
@ -150,7 +253,8 @@ package_customizer_find_package (PackageCustomizer *table, PackageData *package)
{
GList *item;
item = g_list_find_custom (table->packages, package, (GCompareFunc)package_customizer_compare);
item = g_list_find_custom (table->private->packages,
package, (GCompareFunc)package_info_compare);
if (item != NULL) {
return (PackageInfo *)(item->data);
} else {
@ -201,14 +305,14 @@ popup_package_dialog (PackageInfo *info)
title = g_strdup_printf (_("Package info: %s"), info->package->name);
dialog = gnome_dialog_new (title, GNOME_STOCK_BUTTON_OK, NULL);
toplevel = gtk_widget_get_toplevel (info->table->druid_page);
toplevel = gtk_widget_get_toplevel (info->table->private->vbox);
if (GTK_IS_WINDOW (toplevel)) {
gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (toplevel));
}
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
g_free (title);
icon = create_gtk_pixmap (info->table->druid_page, rpm_xpm);
icon = create_gtk_pixmap (info->table->private->vbox, rpm_xpm);
gtk_widget_show (icon);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), icon, FALSE, FALSE, 0);
@ -260,7 +364,7 @@ popup_package_dialog (PackageInfo *info)
g_free (pack_name);
}
hbox = gtk_hbox_new (FALSE, 0);
bong = create_gtk_pixmap (info->table->druid_page, bong_xpm);
bong = create_gtk_pixmap (info->table->private->vbox, bong_xpm);
gtk_widget_show (bong);
gtk_box_pack_start (GTK_BOX (hbox), bong, FALSE, FALSE, 0);
gtk_box_add_padding (hbox, 5, 0);
@ -289,34 +393,34 @@ package_info_click (GtkButton *button, PackageInfo *info)
/* figure out which packages should have bongs, and display them */
static void
package_customizer_recompute_bongs (PackageCustomizer *table)
package_customizer_recompute_bongs (PackageCustomizerPrivate *private)
{
GList *iter, *iter2;
GList *parents, *sub_parents;
PackageInfo *info, *info2;
/* reset bongs */
for (iter = g_list_first (table->packages); iter != NULL; iter = g_list_next (iter)) {
for (iter = g_list_first (private->packages); iter != NULL; iter = g_list_next (iter)) {
info = (PackageInfo *)(iter->data);
info->show_bong = FALSE;
gtk_label_set_color (info->desc, RGB_BLACK);
}
/* find unchecked boxes, trace them up and flip bongs on for the parents */
for (iter = g_list_first (table->packages); iter != NULL; iter = g_list_next (iter)) {
for (iter = g_list_first (private->packages); iter != NULL; iter = g_list_next (iter)) {
info = (PackageInfo *)(iter->data);
if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (info->checkbox))) {
parents = find_package_parents (info->package, table->package_tree, NULL);
parents = find_package_parents (info->package, private->package_tree, NULL);
while (parents != NULL) {
sub_parents = NULL;
for (iter2 = g_list_first (parents); iter2 != NULL; iter2 = g_list_next (iter2)) {
info2 = package_customizer_find_package (table, (PackageData *)(iter2->data));
info2 = package_customizer_find_package (info->table, (PackageData *)(iter2->data));
g_assert (info2 != NULL);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (info2->checkbox))) {
info2->show_bong = TRUE;
gtk_label_set_color (info->desc, RGB_RED);
}
sub_parents = find_package_parents (info2->package, table->package_tree, sub_parents);
sub_parents = find_package_parents (info2->package, private->package_tree, sub_parents);
}
g_list_free (parents);
parents = sub_parents;
@ -325,7 +429,7 @@ package_customizer_recompute_bongs (PackageCustomizer *table)
}
/* now show the bong icons on packages with show_bong set */
for (iter = g_list_first (table->packages); iter != NULL; iter = g_list_next (iter)) {
for (iter = g_list_first (private->packages); iter != NULL; iter = g_list_next (iter)) {
info = (PackageInfo *)(iter->data);
if (info->show_bong) {
gtk_widget_show (info->bong);
@ -340,12 +444,13 @@ package_customizer_recompute_bongs (PackageCustomizer *table)
static void
package_toggled (GtkToggleButton *button, PackageInfo *info)
{
package_customizer_recompute_bongs (info->table);
package_customizer_recompute_bongs (info->table->private);
}
static void
package_customizer_fill (PackageData *package, PackageCustomizer *table)
{
PackageCustomizerPrivate *private;
PackageInfo *info;
GtkWidget *info_pixmap;
GtkWidget *hbox;
@ -356,6 +461,10 @@ package_customizer_fill (PackageData *package, PackageCustomizer *table)
int width, height;
int desc_width;
g_assert (table != NULL);
g_assert (IS_PACKAGE_CUSTOMIZER (table));
private = table->private;
if (package_customizer_find_package (table, package) != NULL) {
return;
}
@ -371,13 +480,13 @@ package_customizer_fill (PackageData *package, PackageCustomizer *table)
info->info_button = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (info->info_button), GTK_RELIEF_NONE);
info_pixmap = create_gtk_pixmap (table->druid_page, info_xpm);
info_pixmap = create_gtk_pixmap (table->private->vbox, info_xpm);
gtk_widget_show (info_pixmap);
gtk_container_add (GTK_CONTAINER (info->info_button), info_pixmap);
gtk_signal_connect (GTK_OBJECT (info->info_button), "clicked", GTK_SIGNAL_FUNC (package_info_click), info);
gtk_widget_show (info->info_button);
info->bong = create_gtk_pixmap (table->druid_page, bong_xpm);
info->bong = create_gtk_pixmap (table->private->vbox, bong_xpm);
gtk_widget_hide (info->bong);
info->no_bong = gtk_label_new ("");
gtk_widget_show (info->no_bong);
@ -392,18 +501,18 @@ package_customizer_fill (PackageData *package, PackageCustomizer *table)
switch (info->group) {
case INSTALL_GROUP:
desc = g_strdup (pack_name);
hbox_group = table->hbox_install;
table->installs++;
hbox_group = private->hbox_install;
private->installs++;
break;
case UPGRADE_GROUP:
desc = g_strdup_printf (_("%s (from v%s)"), pack_name, info->version);
hbox_group = table->hbox_upgrade;
table->upgrades++;
hbox_group = private->hbox_upgrade;
private->upgrades++;
break;
case DOWNGRADE_GROUP:
desc = g_strdup_printf (_("%s (from v%s)"), pack_name, info->version);
hbox_group = table->hbox_downgrade;
table->downgrades++;
hbox_group = private->hbox_downgrade;
private->downgrades++;
break;
default:
g_assert_not_reached ();
@ -416,13 +525,13 @@ package_customizer_fill (PackageData *package, PackageCustomizer *table)
gtk_label_set_color (info->desc, RGB_BLACK);
gtk_label_set_justify (GTK_LABEL (info->desc), GTK_JUSTIFY_LEFT);
desc_width = gdk_string_width (info->desc->style->font, desc);
if (desc_width > table->largest_desc_width) {
table->largest_desc_width = desc_width;
if (desc_width > private->largest_desc_width) {
private->largest_desc_width = desc_width;
}
g_free (desc);
gtk_widget_show (info->desc);
table->packages = g_list_prepend (table->packages, info);
private->packages = g_list_prepend (private->packages, info);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), info->desc, FALSE, FALSE, 0);
@ -472,52 +581,60 @@ normalize_labels (PackageCustomizer *table, GtkWidget *hbox_group)
vbox_desc = gtk_box_nth (hbox_group, 1);
top_label = gtk_box_nth (vbox_desc, 0);
/* -2 : magic gtk number meaning "don't change" */
gtk_widget_set_usize (top_label, table->largest_desc_width, -2);
gtk_widget_set_usize (top_label, table->private->largest_desc_width, -2);
}
static PackageCustomizer *
package_customizer_new (GtkWidget *page, GList *packages)
void
package_customizer_set_package_list (PackageCustomizer *table, GList *package_tree)
{
PackageCustomizer *table = g_new0 (PackageCustomizer, 1);
PackageCustomizerPrivate *private;
GtkWidget *label;
GList *iter;
table->hbox_install = category_hbox_new ();
table->hbox_upgrade = category_hbox_new ();
table->hbox_downgrade = category_hbox_new ();
table->druid_page = page;
table->packages = NULL;
table->package_tree = packages;
g_return_if_fail (table != NULL);
g_return_if_fail (IS_PACKAGE_CUSTOMIZER (table));
private = table->private;
for (iter = g_list_first (packages); iter != NULL; iter = g_list_next (iter)) {
g_list_free (private->packages);
private->packages = NULL;
private->package_tree = package_tree;
for (iter = g_list_first (package_tree); iter != NULL; iter = g_list_next (iter)) {
package_customizer_fill ((PackageData *)(iter->data), table);
}
table->vbox = gtk_vbox_new (FALSE, 0);
if (table->installs > 0) {
if (private->installs > 0) {
label = gtk_label_new_with_font (_("Packages to install"), FONT_TITLE);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (table->vbox), gtk_label_as_hbox (label), FALSE, FALSE, 5);
normalize_labels (table, table->hbox_install);
gtk_box_pack_start (GTK_BOX (table->vbox), table->hbox_install, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (private->vbox), gtk_label_as_hbox (label), FALSE, FALSE, 5);
normalize_labels (table, private->hbox_install);
gtk_box_pack_start (GTK_BOX (private->vbox), private->hbox_install, FALSE, FALSE, 0);
}
if (table->upgrades > 0) {
if (private->upgrades > 0) {
label = gtk_label_new_with_font (_("Packages to upgrade"), FONT_TITLE);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (table->vbox), gtk_label_as_hbox (label), FALSE, FALSE, 5);
normalize_labels (table, table->hbox_upgrade);
gtk_box_pack_start (GTK_BOX (table->vbox), table->hbox_upgrade, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (private->vbox), gtk_label_as_hbox (label), FALSE, FALSE, 5);
normalize_labels (table, private->hbox_upgrade);
gtk_box_pack_start (GTK_BOX (private->vbox), private->hbox_upgrade, FALSE, FALSE, 0);
}
if (table->downgrades > 0) {
if (private->downgrades > 0) {
label = gtk_label_new_with_font (_("Packages to downgrade"), FONT_TITLE);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (table->vbox), gtk_label_as_hbox (label), FALSE, FALSE, 5);
normalize_labels (table, table->hbox_downgrade);
gtk_box_pack_start (GTK_BOX (table->vbox), table->hbox_downgrade, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (private->vbox), gtk_label_as_hbox (label), FALSE, FALSE, 5);
normalize_labels (table, private->hbox_downgrade);
gtk_box_pack_start (GTK_BOX (private->vbox), private->hbox_downgrade, FALSE, FALSE, 0);
}
gtk_widget_show (table->vbox);
return table;
gtk_widget_show (private->vbox);
}
GtkWidget *
package_customizer_get_widget (PackageCustomizer *table)
{
g_return_val_if_fail (table != NULL, NULL);
g_return_val_if_fail (IS_PACKAGE_CUSTOMIZER (table), NULL);
return table->private->vbox;
}
void
@ -527,17 +644,21 @@ jump_to_package_tree_page (EazelInstaller *installer, GList *packages)
GtkWidget *page;
GtkWidget *pane;
GtkWidget *hbox;
GtkWidget *table_widget;
page = nautilus_druid_page_eazel_new_with_vals (NAUTILUS_DRUID_PAGE_EAZEL_OTHER,
NULL, NULL, NULL, NULL,
create_pixmap (GTK_WIDGET (installer->window),
bootstrap_background));
table = package_customizer_new (page, packages);
table = package_customizer_new ();
package_customizer_set_package_list (table, packages);
table_widget = package_customizer_get_widget (table);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_add_padding (hbox, 10, 0);
gtk_box_pack_start (GTK_BOX (hbox), table->vbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), table_widget, FALSE, FALSE, 0);
gtk_widget_show (table_widget);
gtk_widget_show (hbox);
pane = gtk_scrolled_window_new (NULL, NULL);

View file

@ -0,0 +1,70 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Copyright (C) 2000 Eazel, Inc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors: Robey Pointer <robey@eazel.com>
*/
#ifndef PACKAGE_TREE_H
#define PACKAGE_TREE_H
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* i'm ditching the "eazel" or "trilobite" prefix for this object, because if you link with this object,
* you won't have any other package customizers. it's a pretty darn specific widget to have.
*/
#define TYPE_PACKAGE_CUSTOMIZER (package_customizer_get_type ())
#define PACKAGE_CUSTOMIZER(obj) (GTK_CHECK_CAST ((obj), TYPE_PACKAGE_CUSTOMIZER, PackageCustomizer))
#define PACKAGE_CUSTOMIZER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_PACKAGE_CUSTOMIZER, PackageCustomizerClass))
#define IS_PACKAGE_CUSTOMIZER(obj) (GTK_CHECK_TYPE ((obj), TYPE_PACKAGE_CUSTOMIZER))
#define IS_PACKAGE_CUSTOMIZER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_PACKAGE_CUSTOMIZER))
typedef struct _PackageCustomizer PackageCustomizer;
typedef struct _PackageCustomizerClass PackageCustomizerClass;
typedef struct _PackageCustomizerPrivate PackageCustomizerPrivate;
struct _PackageCustomizerClass
{
GtkObjectClass parent_class;
};
struct _PackageCustomizer
{
GtkObject parent;
PackageCustomizerPrivate *private;
};
GtkType package_customizer_get_type (void);
PackageCustomizer *package_customizer_new (void);
void package_customizer_unref (GtkObject *object);
void package_customizer_set_package_list (PackageCustomizer *table, GList *package_tree);
GtkWidget *package_customizer_get_widget (PackageCustomizer *table);
void jump_to_package_tree_page (EazelInstaller *installer, GList *packages);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* PACKAGE_TREE_H */