fix strcmp style for Darin.

2001-12-18  Michael Meeks  <michael@ximian.com>

	* components/hardware/nautilus-hardware-view.c
	(setup_overview_form): fix strcmp style for Darin.

	* components/music/fileinfo.c (find_genre_id),
	(file_info_http): ditto.

	* libnautilus-private/nautilus-customization-data.c
	(nautilus_customization_data_get_next_element_for_display),
	(nautilus_customization_data_new): ditto.

	* src/nautilus-property-browser.c
	(nautilus_property_browser_drag_data_get),
	(make_category_link, make_drag_image): ditto.

	* libnautilus-private/nautilus-volume-monitor.c
	(option_list_has_option): ditto.

2001-12-17  Michael Meeks  <michael@ximian.com>

	* src/file-manager/fm-directory-view.c
	(fm_directory_view_init): set mask.

	* src/nautilus-view-frame.c
	(create_corba_objects): set ambient property bag.
	(create_ambient_properties),
	(nautilus_view_frame_get_prop): impl.
	(nautilus_view_frame_title_changed),
	(nautilus_view_frame_selection_changed),
	(send_history): re-implement to fire event instead.

	* components/history/nautilus-history-view.c
	(nautilus_history_view_instance_init): set mask.
	(history_changed_callback, update_history): constify.

	* libnautilus/nautilus-view.c
	(impl_Nautilus_View_title_changed),
	(impl_Nautilus_View_history_changed): kill.
	(impl_Nautilus_View_selection_changed): kill.
	(nautilus_view_construct_from_bonobo_control):
	connect to set_frame.
	(nautilus_view_set_frame_callback): impl.
	(nautilus_view_dispose): impl. to unset the frame
	(nautilus_view_class_init): upd signals, epv & hook
	dispose.
	(nautilus_view_frame_property_changed_callback): impl.
	(nautilus_view_get_ambient_properties): impl.
	(nautilus_view_set_listener_mask): impl.

	* libnautilus/nautilus-view-component.idl: remove
	title_changed and history_changed - use a propert
	and the more flexible listener interface.
This commit is contained in:
Michael Meeks 2001-12-21 11:32:29 +00:00 committed by Michael Meeks
parent 057ab89f47
commit b14ecf3268
12 changed files with 457 additions and 97 deletions

View file

@ -1,3 +1,57 @@
2001-12-18 Michael Meeks <michael@ximian.com>
* components/hardware/nautilus-hardware-view.c
(setup_overview_form): fix strcmp style for Darin.
* components/music/fileinfo.c (find_genre_id),
(file_info_http): ditto.
* libnautilus-private/nautilus-customization-data.c
(nautilus_customization_data_get_next_element_for_display),
(nautilus_customization_data_new): ditto.
* src/nautilus-property-browser.c
(nautilus_property_browser_drag_data_get),
(make_category_link, make_drag_image): ditto.
* libnautilus-private/nautilus-volume-monitor.c
(option_list_has_option): ditto.
2001-12-17 Michael Meeks <michael@ximian.com>
* src/file-manager/fm-directory-view.c
(fm_directory_view_init): set mask.
* src/nautilus-view-frame.c
(create_corba_objects): set ambient property bag.
(create_ambient_properties),
(nautilus_view_frame_get_prop): impl.
(nautilus_view_frame_title_changed),
(nautilus_view_frame_selection_changed),
(send_history): re-implement to fire event instead.
* components/history/nautilus-history-view.c
(nautilus_history_view_instance_init): set mask.
(history_changed_callback, update_history): constify.
* libnautilus/nautilus-view.c
(impl_Nautilus_View_title_changed),
(impl_Nautilus_View_history_changed): kill.
(impl_Nautilus_View_selection_changed): kill.
(nautilus_view_construct_from_bonobo_control):
connect to set_frame.
(nautilus_view_set_frame_callback): impl.
(nautilus_view_dispose): impl. to unset the frame
(nautilus_view_class_init): upd signals, epv & hook
dispose.
(nautilus_view_frame_property_changed_callback): impl.
(nautilus_view_get_ambient_properties): impl.
(nautilus_view_set_listener_mask): impl.
* libnautilus/nautilus-view-component.idl: remove
title_changed and history_changed - use a propert
and the more flexible listener interface.
2001-12-17 Darin Adler <darin@bentspoon.com>
* libnautilus-private/nautilus-icon-canvas-item.h:

View file

@ -581,13 +581,13 @@ setup_overview_form (NautilusHardwareView *view)
g_free(proc_file);
/* Set the icon depending on the type of device */
if(!strcmp(ide_media, "disk\n")) {
file_name = nautilus_pixmap_file("i-harddisk.png");
} else if(!strcmp(ide_media, "cdrom\n")) {
file_name = nautilus_pixmap_file("CD_drive.png");
if (strcmp (ide_media, "disk\n") == 0) {
file_name = nautilus_pixmap_file ("i-harddisk.png");
} else if (strcmp (ide_media, "cdrom\n") == 0) {
file_name = nautilus_pixmap_file ("CD_drive.png");
} else {
/* some other device ... still set an icon */
file_name = nautilus_pixmap_file("i-harddisk.png");
file_name = nautilus_pixmap_file ("i-harddisk.png");
}
pixmap_widget = eel_image_new (file_name);

View file

@ -106,8 +106,8 @@ install_icon (GtkCList *list, int row, GdkPixbuf *pixbuf)
}
static void
update_history (NautilusHistoryView *view,
Nautilus_History *history)
update_history (NautilusHistoryView *view,
const Nautilus_History *history)
{
char *cols[HISTORY_VIEW_COLUMN_COUNT];
int new_row;
@ -247,13 +247,13 @@ button_release_callback (GtkCList *list,
}
static void
history_changed_callback (NautilusHistoryView *view,
Nautilus_History *list,
gpointer callback_data)
history_changed_callback (NautilusHistoryView *view,
const Nautilus_History *history,
gpointer callback_data)
{
g_assert (view == callback_data);
update_history (view, list);
update_history (view, history);
}
static void
@ -283,18 +283,21 @@ nautilus_history_view_instance_init (NautilusHistoryView *view)
view->list = list;
g_signal_connect (list,
"button-press-event",
G_CALLBACK (button_press_callback),
view);
"button-press-event",
G_CALLBACK (button_press_callback),
view);
g_signal_connect (list,
"button-release-event",
G_CALLBACK (button_release_callback),
view);
"button-release-event",
G_CALLBACK (button_release_callback),
view);
nautilus_view_set_listener_mask (NAUTILUS_VIEW (view),
NAUTILUS_VIEW_LISTEN_HISTORY);
g_signal_connect (view,
"history_changed",
G_CALLBACK (history_changed_callback),
view);
"history_changed",
G_CALLBACK (history_changed_callback),
view);
}
static void

View file

@ -64,7 +64,7 @@ static gint find_genre_id(gchar * text)
for (i = 0; i < GENRE_MAX; i++)
{
if (!strcmp(mpg123_id3_genres[i], text))
if (strcmp (mpg123_id3_genres[i], text) == 0)
return i;
}
if (text[0] == '\0')
@ -179,7 +179,7 @@ static gchar* channel_mode_name(int mode)
static void file_info_http(char *filename)
{
gtk_widget_set_sensitive(id3_frame, FALSE);
if (mpg123_filename && !strcmp(filename, mpg123_filename) &&
if (mpg123_filename && strcmp(filename, mpg123_filename) == 0 &&
mpg123_bitrate != 0)
{
set_mpeg_level_label(mpg123_mpeg25, mpg123_lsf, mpg123_layer);

View file

@ -134,7 +134,7 @@ nautilus_customization_data_new (const char *customization_name,
}
/* load the frame if necessary */
if (!strcmp(customization_name, "patterns")) {
if (strcmp (customization_name, "patterns") == 0) {
temp_str = nautilus_pixmap_file ("chit_frame.png");
data->pattern_frame = gdk_pixbuf_new_from_file (temp_str, NULL);
g_free (temp_str);
@ -213,7 +213,7 @@ nautilus_customization_data_get_next_element_for_display (NautilusCustomizationD
*emblem_name = g_strdup (current_file_info->name);
if (!strcmp(data->customization_name, "patterns")) {
if (strcmp (data->customization_name, "patterns") == 0) {
pixbuf = nautilus_customization_make_pattern_chit (orig_pixbuf, data->pattern_frame, FALSE, is_reset_image);
} else {
pixbuf = eel_gdk_pixbuf_scale_down_to_fit (orig_pixbuf,

View file

@ -1005,7 +1005,7 @@ option_list_has_option (const char *optlist,
options = g_strsplit (optlist, ",", -1);
for (i = 0; options[i]; i++) {
if (!strcmp (options[i], option)) {
if (strcmp (options[i], option) == 0) {
retval = TRUE;
break;
}

View file

@ -66,20 +66,16 @@ module Nautilus {
*/
oneway void load_location (in URI location);
oneway void stop_loading ();
/* Called to tell the view about selection changes. */
oneway void selection_changed (in URIList selection);
/* Called to tell the view about title changes. */
oneway void title_changed (in string title);
/* Called to tell the view about history changes. */
oneway void history_changed (in History history);
};
/* The ViewFrame interface is used by the view to communicate
* with the Nautilus shell. It's implemented as an interface
* on the Bonobo::ControlFrame for the view.
*
* The Ambient properties on the ControlFrame are:
* 'title' - ro - string - the title
* 'history' - ro - Nautilus::History - the history list
* 'selection' - ro - URIList - the selection
*/
interface ViewFrame : ::Bonobo::Unknown {
/* Called by the view component to change the location

View file

@ -30,11 +30,15 @@
nautilus view implementation. */
#include <config.h>
#include <string.h>
#include "nautilus-view.h"
#include "nautilus-idle-queue.h"
#include "nautilus-undo.h"
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-listener.h>
#include <bonobo/bonobo-event-source.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-ui-util.h>
#include <gtk/gtkmain.h>
@ -54,9 +58,14 @@ enum {
static guint signals[LAST_SIGNAL];
struct NautilusViewDetails {
BonoboControl *control;
NautilusIdleQueue *incoming_queue;
NautilusIdleQueue *outgoing_queue;
BonoboControl *control;
NautilusViewListenerMask listen_mask;
BonoboListener *listener;
Bonobo_EventSource event_source;
NautilusIdleQueue *incoming_queue;
NautilusIdleQueue *outgoing_queue;
};
typedef void (* ViewFunction) (NautilusView *view,
@ -235,37 +244,163 @@ impl_Nautilus_View_stop_loading (PortableServer_Servant servant,
NULL);
}
static void
nautilus_view_frame_property_changed_callback (BonoboListener *listener,
const char *event_name,
const CORBA_any *any,
CORBA_Environment *ev,
gpointer user_data)
{
NautilusView *view;
ViewFunction callback;
gpointer callback_data;
GDestroyNotify destroy_callback_data;
view = user_data;
g_return_if_fail (NAUTILUS_IS_VIEW (user_data));
if (strcmp (event_name, "Bonobo/Property:change:title") == 0) {
callback = call_title_changed;
callback_data = g_strdup (BONOBO_ARG_GET_STRING (any));
destroy_callback_data = g_free;
} else if (strcmp (event_name, "Bonobo/Property:change:history") == 0) {
callback = call_history_changed;
callback_data = history_dup (any->_value);
destroy_callback_data = CORBA_free;
} else if (strcmp (event_name, "Bonobo/Property:change:selection") == 0) {
callback = call_selection_changed;
callback_data = nautilus_g_list_from_uri_list (any->_value);
destroy_callback_data = list_deep_free_cover;
} else {
g_warning ("Unknown event '%s'", event_name);
return;
}
nautilus_idle_queue_add (view->details->incoming_queue,
(GFunc) callback,
view,
callback_data,
destroy_callback_data);
}
static void
impl_Nautilus_View_selection_changed (PortableServer_Servant servant,
const Nautilus_URIList *selection,
CORBA_Environment *ev)
append_mask (GString *str, const char *mask_element)
{
queue_incoming_call (servant,
call_selection_changed,
nautilus_g_list_from_uri_list (selection),
list_deep_free_cover);
if (str->len) {
g_string_append_c (str, ',');
}
g_string_append (str, mask_element);
}
static void
impl_Nautilus_View_title_changed (PortableServer_Servant servant,
const CORBA_char *title,
CORBA_Environment *ev)
/*
* FIXME: we should use this 'set_frame' method to keep
* a cached CORBA_Object_duplicated reference to the
* remote NautilusViewFrame, since this would save lots
* of remote QI / unref traffic in all the methods that
* use view_frame_call_begin.
*/
static void
nautilus_view_set_frame (NautilusView *view,
Bonobo_ControlFrame frame)
{
queue_incoming_call (servant,
call_title_changed,
g_strdup (title),
g_free);
BonoboListener *listener;
CORBA_Environment ev;
Bonobo_EventSource es;
Bonobo_PropertyBag pbag;
GString *mask;
if (view->details->listen_mask == 0) { /* Defer until we need to */
return;
}
CORBA_exception_init (&ev);
if ((listener = view->details->listener) != NULL) {
view->details->listener = NULL;
bonobo_event_source_client_remove_listener (
view->details->event_source,
BONOBO_OBJREF (listener), NULL);
CORBA_Object_release (view->details->event_source, &ev);
bonobo_object_unref (BONOBO_OBJECT (listener));
}
if (frame != CORBA_OBJECT_NIL) {
pbag = bonobo_control_get_ambient_properties (
view->details->control, &ev);
if (BONOBO_EX (&ev)) {
goto add_failed;
}
if (pbag == CORBA_OBJECT_NIL) {
g_warning ("NautilusView: contractural breakage - "
"NautilusViewFrame has no ambient property bag");
goto add_failed;
}
es = Bonobo_Unknown_queryInterface (
pbag, "IDL:Bonobo/EventSource:1.0", &ev);
if (BONOBO_EX (&ev)) {
goto add_failed;
}
if (es == CORBA_OBJECT_NIL) {
g_warning ("Contractural breakage - NautilusViewFrame's "
"ambient property bag has no event source");
goto add_failed;
}
view->details->event_source = CORBA_Object_duplicate (es, &ev);
bonobo_object_release_unref (es, &ev);
listener = bonobo_listener_new (
nautilus_view_frame_property_changed_callback, view);
view->details->listener = listener;
mask = g_string_sized_new (128);
if (view->details->listen_mask & NAUTILUS_VIEW_LISTEN_TITLE)
append_mask (mask, "Bonobo/Property:change:title");
if (view->details->listen_mask & NAUTILUS_VIEW_LISTEN_HISTORY)
append_mask (mask, "Bonobo/Property:change:history");
if (view->details->listen_mask & NAUTILUS_VIEW_LISTEN_SELECTION)
append_mask (mask, "Bonobo/Property:change:selection");
Bonobo_EventSource_addListenerWithMask (
es, BONOBO_OBJREF (listener), mask->str, &ev);
g_string_free (mask, TRUE);
}
add_failed:
CORBA_exception_free (&ev);
}
static void
impl_Nautilus_View_history_changed (PortableServer_Servant servant,
const Nautilus_History *history,
CORBA_Environment *ev)
static void
nautilus_view_set_frame_callback (BonoboControl *control,
NautilusView *view)
{
queue_incoming_call (servant,
call_history_changed,
history_dup (history),
CORBA_free);
Bonobo_ControlFrame frame;
g_return_if_fail (NAUTILUS_IS_VIEW (view));
frame = bonobo_control_get_control_frame (control, NULL);
nautilus_view_set_frame (view, frame);
}
static void
@ -311,6 +446,10 @@ nautilus_view_construct_from_bonobo_control (NautilusView *view,
bonobo_object_add_interface (BONOBO_OBJECT (view), BONOBO_OBJECT (control));
nautilus_undo_set_up_bonobo_control (control);
g_signal_connect (G_OBJECT (control), "set_frame",
G_CALLBACK (nautilus_view_set_frame_callback),
view);
return view;
}
@ -329,6 +468,18 @@ nautilus_view_finalize (GObject *object)
GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
static void
nautilus_view_dispose (GObject *object)
{
NautilusView *view;
view = NAUTILUS_VIEW (object);
nautilus_view_set_frame (view, CORBA_OBJECT_NIL);
GNOME_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
}
static Nautilus_ViewFrame
view_frame_call_begin (NautilusView *view, CORBA_Environment *ev)
{
@ -802,6 +953,7 @@ nautilus_view_class_init (NautilusViewClass *klass)
POA_Nautilus_View__epv *epv = &klass->epv;
G_OBJECT_CLASS (klass)->finalize = nautilus_view_finalize;
G_OBJECT_CLASS (klass)->dispose = nautilus_view_dispose;
signals[LOAD_LOCATION] =
g_signal_new ("load_location",
@ -844,9 +996,34 @@ nautilus_view_class_init (NautilusViewClass *klass)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
epv->load_location = impl_Nautilus_View_load_location;
epv->stop_loading = impl_Nautilus_View_stop_loading;
epv->selection_changed = impl_Nautilus_View_selection_changed;
epv->title_changed = impl_Nautilus_View_title_changed;
epv->history_changed = impl_Nautilus_View_history_changed;
epv->load_location = impl_Nautilus_View_load_location;
epv->stop_loading = impl_Nautilus_View_stop_loading;
}
Bonobo_PropertyBag
nautilus_view_get_ambient_properties (NautilusView *view,
CORBA_Environment *opt_ev)
{
g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL);
return bonobo_control_get_ambient_properties (
view->details->control, opt_ev);
}
void
nautilus_view_set_listener_mask (NautilusView *view,
NautilusViewListenerMask mask)
{
if (!view->details->listen_mask) {
Bonobo_ControlFrame frame;
view->details->listen_mask = mask;
frame = bonobo_control_get_control_frame (
view->details->control, NULL);
if (frame != CORBA_OBJECT_NIL) {
nautilus_view_set_frame (view, frame);
}
}
}

View file

@ -54,12 +54,14 @@ typedef struct {
void (* load_location) (NautilusView *view,
const char *location_uri);
void (* stop_loading) (NautilusView *view);
void (* selection_changed) (NautilusView *view,
GList *selection); /* list of URI char *s */
void (* title_changed) (NautilusView *view,
const char *title);
void (* history_changed) (NautilusView *view,
/* These signals need to be enabled with nautilus_view_set_listener_mask */
void (* title_changed) (NautilusView *view,
const char *title);
void (* history_changed) (NautilusView *view,
const Nautilus_History *history);
void (* selection_changed) (NautilusView *view,
GList *selection);
} NautilusViewClass;
GtkType nautilus_view_get_type (void);
@ -110,6 +112,18 @@ BonoboUIComponent *nautilus_view_set_up_ui (NautilusV
const char *ui_xml_file_name,
const char *application_name);
typedef enum {
NAUTILUS_VIEW_LISTEN_TITLE = 1<<0,
NAUTILUS_VIEW_LISTEN_HISTORY = 1<<1,
NAUTILUS_VIEW_LISTEN_SELECTION = 1<<2
} NautilusViewListenerMask;
Bonobo_PropertyBag nautilus_view_get_ambient_properties (NautilusView *view,
CORBA_Environment *opt_ev);
void nautilus_view_set_listener_mask (NautilusView *view,
NautilusViewListenerMask mask);
/* `protected' functions for use by subclasses only. */
NautilusView * nautilus_view_construct (NautilusView *view,
GtkWidget *widget);

View file

@ -1212,6 +1212,11 @@ fm_directory_view_init (FMDirectoryView *view)
"load_location",
G_CALLBACK (load_location_callback),
view);
nautilus_view_set_listener_mask (
NAUTILUS_VIEW (view->details->nautilus_view),
NAUTILUS_VIEW_LISTEN_SELECTION);
g_signal_connect (view->details->nautilus_view,
"selection_changed",
G_CALLBACK (selection_changed_callback),

View file

@ -550,13 +550,15 @@ nautilus_property_browser_drag_data_get (GtkWidget *widget,
but for now we hardwire it to the drag_type */
is_reset = FALSE;
if (!strcmp(property_browser->details->drag_type, "property/keyword")) {
if (strcmp (property_browser->details->drag_type,
"property/keyword") == 0) {
char* keyword_str = strip_extension(property_browser->details->dragged_file);
gtk_selection_data_set(selection_data, selection_data->target, 8, keyword_str, strlen(keyword_str));
g_free(keyword_str);
return;
}
else if (!strcmp(property_browser->details->drag_type, "application/x-color")) {
else if (strcmp (property_browser->details->drag_type,
"application/x-color") == 0) {
GdkColor color;
guint16 colorArray[4];
@ -668,7 +670,7 @@ make_drag_image (NautilusPropertyBrowser *property_browser, const char* file_nam
is_reset = eel_strcmp (file_name, RESET_IMAGE_NAME) == 0;
if (!strcmp(property_browser->details->category, "patterns")) {
if (strcmp (property_browser->details->category, "patterns") == 0) {
pixbuf = nautilus_customization_make_pattern_chit (orig_pixbuf, property_browser->details->property_chit, TRUE, is_reset);
} else {
pixbuf = eel_gdk_pixbuf_scale_down_to_fit (orig_pixbuf, MAX_ICON_WIDTH, MAX_ICON_HEIGHT);
@ -1519,7 +1521,7 @@ element_clicked_callback (GtkWidget *image_table,
/* compute the offsets for dragging */
scroll_offset = eel_viewport_get_scroll_offset (EEL_VIEWPORT (image_table->parent));
if (strcmp(drag_types[0].target, "application/x-color")) {
if (strcmp (drag_types[0].target, "application/x-color")) {
/*it's not a color, so, for now, it must be an image */
/* fiddle with the category to handle the "reset" case properly */
char * save_category = property_browser->details->category;
@ -1838,9 +1840,9 @@ make_category(NautilusPropertyBrowser *property_browser, const char* path, const
eel_label_set_text (EEL_LABEL (property_browser->details->help_label), description);
/* case out on the mode */
if (strcmp(mode, "directory") == 0)
if (strcmp (mode, "directory") == 0)
make_properties_from_directories (property_browser);
else if (strcmp(mode, "inline") == 0)
else if (strcmp (mode, "inline") == 0)
make_properties_from_xml_node (property_browser, node);
}
@ -1891,7 +1893,8 @@ make_category_link (NautilusPropertyBrowser *property_browser,
gtk_widget_show (button);
/* if the button represents the current category, highlight it */
if (property_browser->details->category && !strcmp(property_browser->details->category, name)) {
if (property_browser->details->category &&
strcmp (property_browser->details->category, name) == 0) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
property_browser->details->selected_button = button;
}

View file

@ -35,6 +35,7 @@
#include "nautilus-signaller.h"
#include "nautilus-view-frame-private.h"
#include "nautilus-window.h"
#include <bonobo/bonobo-event-source.h>
#include <bonobo/bonobo-control-frame.h>
#include <bonobo/bonobo-zoomable-frame.h>
#include <bonobo/bonobo-zoomable.h>
@ -89,6 +90,7 @@ struct NautilusViewFrameDetails {
/* The view frame Bonobo objects. */
BonoboObject *view_frame;
BonoboEventSource *event_source;
BonoboControlFrame *control_frame;
BonoboZoomableFrame *zoomable_frame;
@ -483,6 +485,96 @@ zoom_level_changed_callback (BonoboZoomableFrame *zframe,
g_free);
}
enum {
BONOBO_PROPERTY_TITLE,
BONOBO_PROPERTY_HISTORY,
BONOBO_PROPERTY_SELECTION
};
static Nautilus_History *
get_history_list (NautilusViewFrame *view)
{
Nautilus_History *history_list;
history_list = NULL;
g_signal_emit (view,
signals[GET_HISTORY_LIST], 0,
&history_list);
return history_list;
}
static void
nautilus_view_frame_get_prop (BonoboPropertyBag *bag,
BonoboArg *arg,
guint arg_id,
CORBA_Environment *ev,
gpointer user_data)
{
NautilusViewFrame *view = user_data;
g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (user_data));
switch (arg_id) {
case BONOBO_PROPERTY_TITLE:
BONOBO_ARG_SET_STRING (arg, view->details->title);
break;
case BONOBO_PROPERTY_HISTORY:
CORBA_free (arg->_value);
arg->_value = get_history_list (view);
break;
case BONOBO_PROPERTY_SELECTION:
g_warning ("NautilusViewFrame: selection fetch not yet implemented");
break;
default:
g_warning ("NautilusViewFrame: Unknown property idx %d", arg_id);
break;
}
}
static BonoboPropertyBag *
create_ambient_properties (NautilusViewFrame *view)
{
BonoboPropertyBag *pbag;
pbag = bonobo_property_bag_new (
nautilus_view_frame_get_prop,
NULL, view);
bonobo_property_bag_add (
pbag,
"title",
BONOBO_PROPERTY_TITLE,
TC_CORBA_string,
NULL,
_("a title"),
BONOBO_PROPERTY_READABLE);
bonobo_property_bag_add (
pbag,
"history",
BONOBO_PROPERTY_HISTORY,
TC_Nautilus_History,
NULL,
_("the browse history"),
BONOBO_PROPERTY_READABLE);
bonobo_property_bag_add (
pbag,
"selection",
BONOBO_PROPERTY_SELECTION,
TC_Nautilus_URIList,
NULL,
_("the current selection"),
BONOBO_PROPERTY_READABLE);
view->details->event_source = pbag->es;
return pbag;
}
static void
create_corba_objects (NautilusViewFrame *view)
{
@ -501,6 +593,11 @@ create_corba_objects (NautilusViewFrame *view)
g_assert (ev._major == CORBA_NO_EXCEPTION);
view->details->control_frame = bonobo_control_frame_new
(bonobo_object_corba_objref (BONOBO_OBJECT (view->details->ui_container)));
bonobo_control_frame_set_propbag (
view->details->control_frame,
create_ambient_properties (view));
bonobo_control_frame_bind_to_control (view->details->control_frame, control, NULL);
bonobo_object_release_unref (control, NULL);
@ -773,8 +870,9 @@ void
nautilus_view_frame_selection_changed (NautilusViewFrame *view,
GList *selection)
{
Nautilus_URIList *uri_list;
BonoboArg *arg;
CORBA_Environment ev;
Nautilus_URIList *uri_list;
g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
@ -785,19 +883,26 @@ nautilus_view_frame_selection_changed (NautilusViewFrame *view,
uri_list = nautilus_uri_list_from_g_list (selection);
CORBA_exception_init (&ev);
Nautilus_View_selection_changed (view->details->view, uri_list, &ev);
arg = bonobo_arg_new_from (TC_Nautilus_URIList, uri_list);
bonobo_event_source_notify_listeners (
view->details->event_source,
"Bonobo/Property:change:selection", arg, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
view_frame_failed (view);
}
CORBA_exception_free (&ev);
CORBA_free (uri_list);
CORBA_free (arg);
}
void
nautilus_view_frame_title_changed (NautilusViewFrame *view,
const char *title)
{
BonoboArg arg;
CORBA_Environment ev;
g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
@ -807,10 +912,18 @@ nautilus_view_frame_title_changed (NautilusViewFrame *view,
}
CORBA_exception_init (&ev);
Nautilus_View_title_changed (view->details->view, title, &ev);
arg._type = TC_CORBA_string;
arg._value = &title;
bonobo_event_source_notify_listeners (
view->details->event_source,
"Bonobo/Property:change:title", &arg, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
view_frame_failed (view);
}
CORBA_exception_free (&ev);
}
@ -1211,26 +1324,15 @@ nautilus_view_frame_map (GtkWidget *view_as_widget)
}
}
static Nautilus_History *
get_history_list (NautilusViewFrame *view)
{
Nautilus_History *history_list;
history_list = NULL;
g_signal_emit (view,
signals[GET_HISTORY_LIST], 0,
&history_list);
return history_list;
}
static void
send_history (NautilusViewFrame *view)
{
Nautilus_History *history;
CORBA_Environment ev;
BonoboArg *arg;
g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
if (view->details->view == CORBA_OBJECT_NIL) {
return;
}
@ -1239,15 +1341,21 @@ send_history (NautilusViewFrame *view)
if (history == NULL) {
return;
}
CORBA_exception_init (&ev);
Nautilus_View_history_changed (view->details->view, history, &ev);
arg = bonobo_arg_new_from (TC_Nautilus_History, history);
bonobo_event_source_notify_listeners (
view->details->event_source,
"Bonobo/Property:change:history", arg, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
view_frame_failed (view);
}
CORBA_exception_free (&ev);
CORBA_free (history);
CORBA_free (arg);
}
gboolean