Commit 53c5e06a authored by Maciej Stachowiak's avatar Maciej Stachowiak
Browse files

Changed NautilusViewFrame to allow creation of `Nautilus::View' objects

	* libnautilus/ntl-view-frame.c, libnautilus/ntl-view-frame.h:
	Changed NautilusViewFrame to allow creation of `Nautilus::View'
	objects that have additional interfaces while sharing the actual
	control. This will allow, for instance, the creation of components
	that are both a `Nautilus::View' and a `Bonobo::Embeddable'. The
	basic changes are to require a `BonoboObject' with a
	`Bonobo::Control' interface at construction time.
	- Two creation functions are provided: `nautilus_view_frame_new',
	which takes a GtkWidget, creates a new control that contains that
	widget, and the constructs a NautilusViewFrame with that control,
	and `nautilus_view_frame_new_from_control', which creates a
	NautilusViewFrame that gets added as an additional interface to an
	existing control.
	- In the course of doing this it became clear that it would be
	easier if NautilusViewFrame were changed to inherit from
	BonoboObject rather than GtkBin, so this was done; as a result,
	the nautilus_view_frame_get_bonobo_object call was removed, since
	the view_frame _is_ a bonobo object. However, a
	nautilus_view_frame_get_bonobo_control call was added as a
	convenience, to allow other code to avoid having to
	query_local_interface for the control object manually.
	* libnautilus/ntl-meta-view-frame.c,
	libnautilus/ntl-meta-view-frame.h,
	libnautilus/ntl-content-view-frame.c,
	libnautilus/ntl-content-view-frame.h: Analogous changes; mainly,
	added `nautilus_meta_view_frame_new',
	`nautilus_meta_view_frame_new_from_control',
	`nautilus_content_view_frame_new' and
	`nautilus_content_view_frame_new_from_control'.
	* components/help/hyperbola-nav-index.c,
	components/help/hyperbola-nav-tree.c,
	components/history/ntl-history-view.c,
	components/html/ntl-web-browser.c, components/notes/ntl-notes.c,
	components/websearch/ntl-web-search.c, src/ntl-app.c,
	src/file-manager/fm-directory-view.c: Fixed initialization and
	object creation functions to deal with the above API change.
parent 223a3193
2000-02-19 Maciej Stachowiak <mjs@eazel.com>
* libnautilus/ntl-view-frame.c, libnautilus/ntl-view-frame.h:
Changed NautilusViewFrame to allow creation of `Nautilus::View'
objects that have additional interfaces while sharing the actual
control. This will allow, for instance, the creation of components
that are both a `Nautilus::View' and a `Bonobo::Embeddable'. The
basic changes are to require a `BonoboObject' with a
`Bonobo::Control' interface at construction time.
- Two creation functions are provided: `nautilus_view_frame_new',
which takes a GtkWidget, creates a new control that contains that
widget, and the constructs a NautilusViewFrame with that control,
and `nautilus_view_frame_new_from_control', which creates a
NautilusViewFrame that gets added as an additional interface to an
existing control.
- In the course of doing this it became clear that it would be
easier if NautilusViewFrame were changed to inherit from
BonoboObject rather than GtkBin, so this was done; as a result,
the nautilus_view_frame_get_bonobo_object call was removed, since
the view_frame _is_ a bonobo object. However, a
nautilus_view_frame_get_bonobo_control call was added as a
convenience, to allow other code to avoid having to
query_local_interface for the control object manually.
* libnautilus/ntl-meta-view-frame.c,
libnautilus/ntl-meta-view-frame.h,
libnautilus/ntl-content-view-frame.c,
libnautilus/ntl-content-view-frame.h: Analogous changes; mainly,
added `nautilus_meta_view_frame_new',
`nautilus_meta_view_frame_new_from_control',
`nautilus_content_view_frame_new' and
`nautilus_content_view_frame_new_from_control'.
* components/help/hyperbola-nav-index.c,
components/help/hyperbola-nav-tree.c,
components/history/ntl-history-view.c,
components/html/ntl-web-browser.c, components/notes/ntl-notes.c,
components/websearch/ntl-web-search.c, src/ntl-app.c,
src/file-manager/fm-directory-view.c: Fixed initialization and
object creation functions to deal with the above API change.
2000-02-18 Maciej Stachowiak <mjs@eazel.com>
* RENAMING: Suggest swapping the names NautilusView and
......
......@@ -131,9 +131,6 @@ BonoboObject *hyperbola_navigation_index_new(void)
hni = g_new0(HyperbolaNavigationIndex, 1);
hni->items = g_array_new(FALSE, FALSE, sizeof(IndexItem));
hni->view_frame = NAUTILUS_VIEW_FRAME(gtk_widget_new(nautilus_meta_view_frame_get_type(), NULL));
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hni->view_frame), _("Help Index"));
hni->ent = gtk_entry_new();
gtk_signal_connect(GTK_OBJECT(hni->ent), "changed", hyperbola_navigation_index_ent_changed, hni);
gtk_signal_connect(GTK_OBJECT(hni->ent), "activate", hyperbola_navigation_index_ent_activate, hni);
......@@ -148,7 +145,6 @@ BonoboObject *hyperbola_navigation_index_new(void)
wtmp = gtk_scrolled_window_new(gtk_clist_get_hadjustment(GTK_CLIST(hni->clist)),
gtk_clist_get_vadjustment(GTK_CLIST(hni->clist)));
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(wtmp), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(hni->view_frame), wtmp);
gtk_container_add(GTK_CONTAINER(wtmp), hni->clist);
hyperbola_navigation_index_update_clist(hni);
......@@ -157,5 +153,8 @@ BonoboObject *hyperbola_navigation_index_new(void)
gtk_widget_show(hni->clist);
gtk_widget_show(wtmp);
return nautilus_view_frame_get_bonobo_object(hni->view_frame);
hni->view_frame = NAUTILUS_VIEW_FRAME (nautilus_meta_view_frame_new (wtmp));
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hni->view_frame), _("Help Index"));
return BONOBO_OBJECT (hni->view_frame);
}
......@@ -70,12 +70,6 @@ hyperbola_navigation_tree_new(void)
view = g_new0(HyperbolaNavigationTree, 1);
view->view_frame = NAUTILUS_VIEW_FRAME(gtk_widget_new(nautilus_meta_view_frame_get_type(), NULL));
gtk_signal_connect(GTK_OBJECT(view->view_frame), "notify_location_change", hyperbola_navigation_tree_notify_location_change,
view);
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(view->view_frame), _("Help Contents"));
view->ctree = gtk_ctree_new_with_titles(1, 0, (gchar **)titles);
gtk_clist_freeze(GTK_CLIST(view->ctree));
gtk_clist_set_selection_mode(GTK_CLIST(view->ctree), GTK_SELECTION_BROWSE);
......@@ -88,16 +82,21 @@ hyperbola_navigation_tree_new(void)
wtmp = gtk_scrolled_window_new(gtk_clist_get_hadjustment(GTK_CLIST(view->ctree)),
gtk_clist_get_vadjustment(GTK_CLIST(view->ctree)));
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(wtmp), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(view->view_frame), wtmp);
gtk_container_add(GTK_CONTAINER(wtmp), view->ctree);
gtk_clist_columns_autosize(GTK_CLIST(view->ctree));
gtk_clist_thaw(GTK_CLIST(view->ctree));
gtk_widget_show(view->ctree);
gtk_widget_show(wtmp);
gtk_widget_show(GTK_WIDGET(view->view_frame));
return nautilus_view_frame_get_bonobo_object(view->view_frame);
view->view_frame = NAUTILUS_VIEW_FRAME (nautilus_meta_view_frame_new (wtmp));
gtk_signal_connect(GTK_OBJECT(view->view_frame), "notify_location_change",
hyperbola_navigation_tree_notify_location_change,
view);
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(view->view_frame), _("Help Contents"));
return BONOBO_OBJECT (view->view_frame);
}
static void
......
......@@ -172,7 +172,7 @@ hyperbola_navigation_history_select_row(GtkCList *clist, gint row, gint column,
static int object_count = 0;
static void
do_destroy(GtkObject *obj)
do_destroy(GtkObject *obj, HistoryView *hview)
{
object_count--;
if(object_count <= 0)
......@@ -198,9 +198,10 @@ menu_setup(BonoboObject *ctl, HistoryView *hview)
bonobo_ui_handler_menu_parse_uiinfo_tree(history_menu));
}
static BonoboObject * make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
static BonoboObject *
make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
{
GtkWidget *frame, *wtmp;
GtkWidget *wtmp;
GtkCList *clist;
BonoboObject *ctl;
HistoryView *hview;
......@@ -208,16 +209,6 @@ static BonoboObject * make_obj(BonoboGenericFactory *Factory, const char *goad_i
g_return_val_if_fail(!strcmp(goad_id, "ntl_history_view"), NULL);
hview = g_new0(HistoryView, 1);
frame = gtk_widget_new(nautilus_meta_view_frame_get_type(), NULL);
gtk_signal_connect(GTK_OBJECT(frame), "destroy", do_destroy, NULL);
object_count++;
ctl = nautilus_view_frame_get_bonobo_object(NAUTILUS_VIEW_FRAME(frame));
gtk_signal_connect(GTK_OBJECT(ctl), "set_frame", menu_setup, hview);
/* set description */
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(frame),
_("History"));
/* create interface */
clist = GTK_CLIST (gtk_clist_new (HISTORY_VIEW_COLUMN_COUNT));
......@@ -230,19 +221,30 @@ static BonoboObject * make_obj(BonoboGenericFactory *Factory, const char *goad_i
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(wtmp),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(frame), wtmp);
gtk_container_add(GTK_CONTAINER(wtmp), GTK_WIDGET (clist));
gtk_widget_show_all(frame);
gtk_widget_show_all(wtmp);
/* create object */
hview->view = NAUTILUS_VIEW_FRAME (nautilus_meta_view_frame_new (wtmp));
gtk_signal_connect (GTK_OBJECT (hview->view), "destroy", do_destroy, hview);
object_count++;
ctl = nautilus_view_frame_get_bonobo_control (NAUTILUS_VIEW_FRAME (hview->view));
gtk_signal_connect(GTK_OBJECT (ctl), "set_frame", menu_setup, hview);
/* set description */
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hview->view),
_("History"));
/* handle events */
gtk_signal_connect(GTK_OBJECT(frame), "notify_location_change", hyperbola_navigation_history_notify_location_change, hview);
gtk_signal_connect(GTK_OBJECT(hview->view), "notify_location_change", hyperbola_navigation_history_notify_location_change, hview);
gtk_signal_connect(GTK_OBJECT(clist), "select_row", hyperbola_navigation_history_select_row, hview);
hview->view = (NautilusViewFrame *)frame;
hview->clist = (GtkCList *)clist;
return ctl;
return BONOBO_OBJECT (hview->view);
}
int main(int argc, char *argv[])
......
......@@ -172,7 +172,7 @@ hyperbola_navigation_history_select_row(GtkCList *clist, gint row, gint column,
static int object_count = 0;
static void
do_destroy(GtkObject *obj)
do_destroy(GtkObject *obj, HistoryView *hview)
{
object_count--;
if(object_count <= 0)
......@@ -198,9 +198,10 @@ menu_setup(BonoboObject *ctl, HistoryView *hview)
bonobo_ui_handler_menu_parse_uiinfo_tree(history_menu));
}
static BonoboObject * make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
static BonoboObject *
make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
{
GtkWidget *frame, *wtmp;
GtkWidget *wtmp;
GtkCList *clist;
BonoboObject *ctl;
HistoryView *hview;
......@@ -208,16 +209,6 @@ static BonoboObject * make_obj(BonoboGenericFactory *Factory, const char *goad_i
g_return_val_if_fail(!strcmp(goad_id, "ntl_history_view"), NULL);
hview = g_new0(HistoryView, 1);
frame = gtk_widget_new(nautilus_meta_view_frame_get_type(), NULL);
gtk_signal_connect(GTK_OBJECT(frame), "destroy", do_destroy, NULL);
object_count++;
ctl = nautilus_view_frame_get_bonobo_object(NAUTILUS_VIEW_FRAME(frame));
gtk_signal_connect(GTK_OBJECT(ctl), "set_frame", menu_setup, hview);
/* set description */
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(frame),
_("History"));
/* create interface */
clist = GTK_CLIST (gtk_clist_new (HISTORY_VIEW_COLUMN_COUNT));
......@@ -230,19 +221,30 @@ static BonoboObject * make_obj(BonoboGenericFactory *Factory, const char *goad_i
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(wtmp),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(frame), wtmp);
gtk_container_add(GTK_CONTAINER(wtmp), GTK_WIDGET (clist));
gtk_widget_show_all(frame);
gtk_widget_show_all(wtmp);
/* create object */
hview->view = NAUTILUS_VIEW_FRAME (nautilus_meta_view_frame_new (wtmp));
gtk_signal_connect (GTK_OBJECT (hview->view), "destroy", do_destroy, hview);
object_count++;
ctl = nautilus_view_frame_get_bonobo_control (NAUTILUS_VIEW_FRAME (hview->view));
gtk_signal_connect(GTK_OBJECT (ctl), "set_frame", menu_setup, hview);
/* set description */
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hview->view),
_("History"));
/* handle events */
gtk_signal_connect(GTK_OBJECT(frame), "notify_location_change", hyperbola_navigation_history_notify_location_change, hview);
gtk_signal_connect(GTK_OBJECT(hview->view), "notify_location_change", hyperbola_navigation_history_notify_location_change, hview);
gtk_signal_connect(GTK_OBJECT(clist), "select_row", hyperbola_navigation_history_select_row, hview);
hview->view = (NautilusViewFrame *)frame;
hview->clist = (GtkCList *)clist;
return ctl;
return BONOBO_OBJECT (hview->view);
}
int main(int argc, char *argv[])
......
......@@ -567,7 +567,6 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, void *closure)
return NULL;
bi = g_new0(BrowserInfo, 1);
bi->view_frame = NAUTILUS_VIEW_FRAME(gtk_widget_new(nautilus_content_view_frame_get_type(), NULL));
gtk_signal_connect(GTK_OBJECT(bi->view_frame), "notify_location_change", browser_notify_location_change,
bi);
gtk_signal_connect(GTK_OBJECT(bi->view_frame), "destroy", browser_do_destroy, NULL);
......@@ -585,14 +584,13 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, void *closure)
wtmp = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(wtmp), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(bi->view_frame), wtmp);
gtk_container_add(GTK_CONTAINER(wtmp), bi->htmlw);
gtk_widget_show(bi->htmlw);
gtk_widget_show(wtmp);
gtk_widget_show(GTK_WIDGET(bi->view_frame));
return nautilus_view_frame_get_bonobo_object(bi->view_frame);
bi->view_frame = NAUTILUS_VIEW_FRAME (nautilus_content_view_frame_new (wtmp));
return BONOBO_OBJECT (bi->view_frame);
}
int main(int argc, char *argv[])
......
......@@ -45,7 +45,7 @@ typedef struct {
static int notes_object_count = 0;
static void notes_load_metainfo(NotesView *hview)
static void notes_load_metainfo (NotesView *hview)
{
GnomeVFSURI *vfs_uri;
char *file_name;
......@@ -119,8 +119,8 @@ notes_notify_location_change (NautilusViewFrame *view,
}
static void
do_destroy(GtkObject *obj)
{
do_destroy(GtkObject *obj, NotesView *hview)
{
notes_object_count--;
if(notes_object_count <= 0)
gtk_main_quit();
......@@ -129,18 +129,12 @@ do_destroy(GtkObject *obj)
static BonoboObject *
make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
{
GtkWidget *frame, *vbox;
BonoboObject *ctl;
GtkWidget *vbox;
NotesView *hview;
g_return_val_if_fail(!strcmp(goad_id, "ntl_notes_view"), NULL);
hview = g_new0(NotesView, 1);
frame = gtk_widget_new(nautilus_meta_view_frame_get_type(), NULL);
gtk_signal_connect(GTK_OBJECT(frame), "destroy", do_destroy, NULL);
notes_object_count++;
g_return_val_if_fail (!strcmp (goad_id, "ntl_notes_view"), NULL);
ctl = nautilus_view_frame_get_bonobo_object(NAUTILUS_VIEW_FRAME(frame));
hview = g_new0 (NotesView, 1);
/* initialize the current uri */
hview->current_uri = strdup("");
......@@ -148,7 +142,6 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
/* allocate a vbox to hold all of the UI elements */
vbox = gtk_vbox_new(FALSE, GNOME_PAD);
gtk_container_add(GTK_CONTAINER(frame), vbox);
/* create the label */
......@@ -161,18 +154,22 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
gtk_text_set_editable(GTK_TEXT(hview->note_text_field), TRUE);
gtk_box_pack_start (GTK_BOX(vbox), hview->note_text_field, 0, 0, 0);
gtk_widget_show_all(frame);
gtk_widget_show_all (vbox);
/* Create CORBA object. */
hview->view = NAUTILUS_VIEW_FRAME (nautilus_meta_view_frame_new (vbox));
gtk_signal_connect (GTK_OBJECT (hview->view), "destroy", do_destroy, hview);
notes_object_count++;
/* handle events */
gtk_signal_connect(GTK_OBJECT(frame), "notify_location_change", notes_notify_location_change, hview);
gtk_signal_connect (GTK_OBJECT (hview->view), "notify_location_change", notes_notify_location_change, hview);
/* set description */
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(frame),
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hview->view),
_("Notes"));
hview->view = (NautilusViewFrame *)frame;
return ctl;
return BONOBO_OBJECT (hview->view);
}
int main(int argc, char *argv[])
......
......@@ -45,7 +45,7 @@ typedef struct {
static int notes_object_count = 0;
static void notes_load_metainfo(NotesView *hview)
static void notes_load_metainfo (NotesView *hview)
{
GnomeVFSURI *vfs_uri;
char *file_name;
......@@ -119,8 +119,8 @@ notes_notify_location_change (NautilusViewFrame *view,
}
static void
do_destroy(GtkObject *obj)
{
do_destroy(GtkObject *obj, NotesView *hview)
{
notes_object_count--;
if(notes_object_count <= 0)
gtk_main_quit();
......@@ -129,18 +129,12 @@ do_destroy(GtkObject *obj)
static BonoboObject *
make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
{
GtkWidget *frame, *vbox;
BonoboObject *ctl;
GtkWidget *vbox;
NotesView *hview;
g_return_val_if_fail(!strcmp(goad_id, "ntl_notes_view"), NULL);
hview = g_new0(NotesView, 1);
frame = gtk_widget_new(nautilus_meta_view_frame_get_type(), NULL);
gtk_signal_connect(GTK_OBJECT(frame), "destroy", do_destroy, NULL);
notes_object_count++;
g_return_val_if_fail (!strcmp (goad_id, "ntl_notes_view"), NULL);
ctl = nautilus_view_frame_get_bonobo_object(NAUTILUS_VIEW_FRAME(frame));
hview = g_new0 (NotesView, 1);
/* initialize the current uri */
hview->current_uri = strdup("");
......@@ -148,7 +142,6 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
/* allocate a vbox to hold all of the UI elements */
vbox = gtk_vbox_new(FALSE, GNOME_PAD);
gtk_container_add(GTK_CONTAINER(frame), vbox);
/* create the label */
......@@ -161,18 +154,22 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
gtk_text_set_editable(GTK_TEXT(hview->note_text_field), TRUE);
gtk_box_pack_start (GTK_BOX(vbox), hview->note_text_field, 0, 0, 0);
gtk_widget_show_all(frame);
gtk_widget_show_all (vbox);
/* Create CORBA object. */
hview->view = NAUTILUS_VIEW_FRAME (nautilus_meta_view_frame_new (vbox));
gtk_signal_connect (GTK_OBJECT (hview->view), "destroy", do_destroy, hview);
notes_object_count++;
/* handle events */
gtk_signal_connect(GTK_OBJECT(frame), "notify_location_change", notes_notify_location_change, hview);
gtk_signal_connect (GTK_OBJECT (hview->view), "notify_location_change", notes_notify_location_change, hview);
/* set description */
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(frame),
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hview->view),
_("Notes"));
hview->view = (NautilusViewFrame *)frame;
return ctl;
return BONOBO_OBJECT (hview->view);
}
int main(int argc, char *argv[])
......
......@@ -165,23 +165,17 @@ web_search_populate_engines(WebSearchView *hview)
static BonoboObject *
make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
{
GtkWidget *frame, *vbox;
BonoboObject *ctl;
GtkWidget *vbox;
WebSearchView *hview;
g_return_val_if_fail(!strcmp(goad_id, "ntl_websearch_view"), NULL);
hview = g_new0(WebSearchView, 1);
frame = gtk_widget_new(nautilus_meta_view_frame_get_type(), NULL);
gtk_signal_connect(GTK_OBJECT(frame), "destroy", do_destroy, NULL);
object_count++;
ctl = nautilus_view_frame_get_bonobo_object(NAUTILUS_VIEW_FRAME(frame));
vbox = gtk_vbox_new(FALSE, GNOME_PAD);
gtk_container_add(GTK_CONTAINER(frame), vbox);
hview->btn_search = gnome_pixmap_button(gnome_stock_pixmap_widget(frame, GNOME_STOCK_PIXMAP_SEARCH), _("Search"));
hview->btn_search = gnome_pixmap_button(gnome_stock_pixmap_widget (vbox, GNOME_STOCK_PIXMAP_SEARCH), _("Search"));
gtk_signal_connect(GTK_OBJECT(hview->btn_search), "clicked", do_search, hview);
gtk_box_pack_start(GTK_BOX(vbox), hview->btn_search, FALSE, FALSE, GNOME_PAD);
......@@ -213,19 +207,26 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
gtk_signal_connect(GTK_OBJECT(clist), "select_row", web_search_select_row, hview);
#endif
gtk_widget_show_all(frame);
gtk_widget_show_all(vbox);
hview->clist = NULL;
/* create CORBA object */
hview->view = NAUTILUS_VIEW_FRAME (nautilus_meta_view_frame_new (vbox));
gtk_signal_connect(GTK_OBJECT (hview->view), "destroy", do_destroy, NULL);
object_count++;
/* handle events */
gtk_signal_connect(GTK_OBJECT(frame), "notify_location_change", web_search_notify_location_change, hview);
gtk_signal_connect(GTK_OBJECT(hview->view), "notify_location_change", web_search_notify_location_change, hview);
/* set description */
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(frame),
_("WebSearch"));
nautilus_meta_view_frame_set_label (NAUTILUS_META_VIEW_FRAME (hview->view),
_("WebSearch"));
hview->view = (NautilusViewFrame *)frame;
hview->clist = NULL;
return ctl;
return BONOBO_OBJECT (hview->view);
}
int main(int argc, char *argv[])
......
......@@ -29,6 +29,7 @@
#include <config.h>
#include "ntl-content-view-frame.h"
#include <bonobo/bonobo-control.h>
typedef struct {
POA_Nautilus_View servant;
......@@ -87,6 +88,28 @@ nautilus_content_view_frame_init (NautilusContentViewFrame *view)
{
}
NautilusContentViewFrame *
nautilus_content_view_frame_new (GtkWidget *widget)
{
BonoboObject *control;
control = BONOBO_OBJECT (bonobo_control_new (widget));
return nautilus_content_view_frame_new_from_bonobo_control (control);
}
NautilusContentViewFrame *
nautilus_content_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control)
{
NautilusContentViewFrame *view;
view = NAUTILUS_CONTENT_VIEW_FRAME (gtk_object_new (NAUTILUS_TYPE_CONTENT_VIEW_FRAME,
"bonobo_control", bonobo_control,
NULL));
return view;
}
static void
nautilus_content_view_frame_destroy (NautilusContentViewFrame *view)
{
......
......@@ -49,6 +49,8 @@ struct _NautilusContentViewFrame {
NautilusViewFrame parent;
};
GtkType nautilus_content_view_frame_get_type (void);
GtkType nautilus_content_view_frame_get_type (void);
NautilusContentViewFrame *nautilus_content_view_frame_new (GtkWidget *widget);
NautilusContentViewFrame *nautilus_content_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control);
#endif
......@@ -91,6 +91,28 @@ nautilus_meta_view_frame_init (NautilusMetaViewFrame *view)
{
}
NautilusMetaViewFrame *
nautilus_meta_view_frame_new (GtkWidget *widget)
{
BonoboObject *control;
control = BONOBO_OBJECT (bonobo_control_new (widget));
return nautilus_meta_view_frame_new_from_bonobo_control (control);
}
NautilusMetaViewFrame *
nautilus_meta_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control)
{
NautilusMetaViewFrame *view;
view = NAUTILUS_META_VIEW_FRAME (gtk_object_new (NAUTILUS_TYPE_META_VIEW_FRAME,
"bonobo_control", bonobo_control,
NULL));
return view;
}
static void
nautilus_meta_view_frame_destroy (NautilusMetaViewFrame *view)
{
......@@ -118,15 +140,17 @@ nautilus_meta_view_frame_set_label(NautilusMetaViewFrame *mvc, const char *label
BonoboObject *ctl;
BonoboPropertyBag *bag;
ctl = nautilus_view_frame_get_bonobo_object(NAUTILUS_VIEW_FRAME(mvc));
bag = bonobo_control_get_property_bag(BONOBO_CONTROL(ctl));
if(!bag)
ctl = nautilus_view_frame_get_bonobo_control (NAUTILUS_VIEW_FRAME (mvc));
bag = bonobo_control_get_property_bag (BONOBO_CONTROL (ctl));
if (!bag)
{
bag = bonobo_property_bag_new();
bonobo_control_set_property_bag(BONOBO_CONTROL(ctl), bag);
bag = bonobo_property_bag_new ();
bonobo_control_set_property_bag (BONOBO_CONTROL (ctl), bag);
}
bonobo_property_bag_add(bag, "label", "string",
g_strdup(label), g_strdup(label),
_("Label"), BONOBO_PROPERTY_READ_ONLY);
bonobo_property_bag_add (bag, "label", "string",