Commit 84204ad0 authored by Michael Meeks's avatar Michael Meeks Committed by Michael Meeks

unroll control creation, connect to "activate" signal handler not map /

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

	* components/tree/nautilus-tree-view.c
	(nautilus_tree_view_init): unroll control creation,
	connect to "activate" signal handler not map / unmap
	on no-window widget GtkScrolledWindow.
	(tree_map_callback, tree_unmap_callback): kill.
	(tree_activate_callback): impl.

	* components/tree/libmain.c
	(BonoboActivation_Plugin_info) ->
	(Bonobo_Plugin_info).

	* components/tree/Makefile.am: setup ldflags
	correctly, and a LIBADD so we can activate it
	independantly.

	* components/throbber/main.c (main): fix for
	bonobo-activation-server race condition.

	* libnautilus-private/nautilus-marshal.list:
	add VOID:STRING,STRING
parent a0f24894
2001-12-08 Michael Meeks <michael@ximian.com>
* components/tree/nautilus-tree-view.c
(nautilus_tree_view_init): unroll control creation,
connect to "activate" signal handler not map / unmap
on no-window widget GtkScrolledWindow.
(tree_map_callback, tree_unmap_callback): kill.
(tree_activate_callback): impl.
* components/tree/libmain.c
(BonoboActivation_Plugin_info) ->
(Bonobo_Plugin_info).
* components/tree/Makefile.am: setup ldflags
correctly, and a LIBADD so we can activate it
independantly.
* components/throbber/main.c (main): fix for
bonobo-activation-server race condition.
* libnautilus-private/nautilus-marshal.list:
add VOID:STRING,STRING
2001-12-06 Michael Meeks <michael@ximian.com>
* libnautilus/nautilus-view-standard-main.c
......
......@@ -8,6 +8,7 @@ SUBDIRS = \
notes \
sample \
throbber \
tree \
$(NULL)
XXX=
......@@ -16,5 +17,4 @@ XXX=
loser \
music \
text \
tree \
$(NULL)
......@@ -97,19 +97,22 @@ main (int argc, char *argv[])
registration_id = bonobo_activation_make_registration_id ("OAFIID:nautilus_throbber_factory", g_getenv ("DISPLAY"));
#endif
factory = bonobo_generic_factory_new ("OAFIID:nautilus_throbber_factory",
throbber_make_object,
NULL);
throbber_make_object,
NULL);
#ifdef GNOME2_CONVERSION_COMPLETE
g_free (registration_id);
#endif
bonobo_activate ();
do {
gtk_main ();
} while (object_count > 0);
if (factory != NULL) {
bonobo_activate ();
do {
gtk_main ();
} while (object_count > 0);
bonobo_object_unref (BONOBO_OBJECT (factory));
}
bonobo_object_unref (BONOBO_OBJECT (factory));
gnome_vfs_shutdown ();
return EXIT_SUCCESS;
......
......@@ -34,6 +34,15 @@ libnautilus_tree_view_la_SOURCES = \
libmain.c \
$(NULL)
libnautilus_tree_view_la_LDFLAGS = \
-module -avoid-version
libnautilus_tree_view_la_LIBADD = \
$(top_builddir)/libnautilus/libnautilus.la \
$(top_builddir)/libnautilus-private/libnautilus-private.la \
$(COMPONENT_LIBS)
$(NULL)
serverdir = $(libdir)/bonobo/servers
server_in_files = Nautilus_View_tree.server.in
server_DATA = $(server_in_files:.server.in=.server)
......
......@@ -25,21 +25,12 @@
version of tree view. */
#include <config.h>
#include <string.h>
#include "nautilus-tree-view-iids.h"
#include "nautilus-tree-view.h"
#include <bonobo.h>
#include <bonobo-activation/bonobo-activation.h>
/* FIXME bugzilla.gnome.org 42736: bonobo_activation_plugin_unuse can't possibly work! this sucks */
#if 0
static void
tree_shlib_object_destroyed (GtkObject *object)
{
bonobo_activation_plugin_unuse (gtk_object_get_user_data (object));
}
#endif
static CORBA_Object
tree_shlib_make_object (PortableServer_POA poa,
const char *iid,
......@@ -54,14 +45,9 @@ tree_shlib_make_object (PortableServer_POA poa,
view = NAUTILUS_TREE_VIEW (g_object_new (NAUTILUS_TYPE_TREE_VIEW, NULL));
#if 0
g_signal_connect (view, "destroy", tree_shlib_object_destroyed, NULL);
#endif
bonobo_activation_plugin_use (poa, impl_ptr);
return CORBA_Object_duplicate (bonobo_object_corba_objref
(BONOBO_OBJECT (view)), ev);
return CORBA_Object_duplicate (BONOBO_OBJREF (view), ev);
}
static const BonoboActivationPluginObject tree_plugin_list[] = {
......@@ -69,7 +55,7 @@ static const BonoboActivationPluginObject tree_plugin_list[] = {
{ NULL }
};
const BonoboActivationPlugin BonoboActivation_Plugin_info = {
const BonoboActivationPlugin Bonobo_Plugin_info = {
tree_plugin_list,
"Nautilus Tree Sidebar Panel"
};
......@@ -24,17 +24,19 @@
/* nautilus-tree-model.c - model for the tree view */
#include <config.h>
#include "nautilus-tree-model.h"
#include <stdio.h>
#include <string.h>
#include "nautilus-tree-node-private.h"
#include <gtk/gtksignal.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libnautilus-private/nautilus-marshal.h>
#include <libnautilus-private/nautilus-file-attributes.h>
#include <libnautilus-private/nautilus-icon-factory.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-macros.h>
#include <stdio.h>
#include <string.h>
#include "nautilus-tree-model.h"
#include "nautilus-tree-node-private.h"
enum {
NODE_CHANGED,
......@@ -130,7 +132,7 @@ nautilus_tree_model_class_init (gpointer klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (NautilusTreeModelClass, node_removed),
NULL, NULL,
gtk_marshal_VOID__STRING_STRING,
nautilus_marshal_VOID__STRING_STRING,
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
signals[DONE_LOADING_CHILDREN] =
......
......@@ -22,12 +22,10 @@
* Mathieu Lacage <mathieu@eazel.com>
*/
/* nautilus-tree-view-dnd.c: dnd code for the tree view.
*/
/* nautilus-tree-view-dnd.c: dnd code for the tree view. */
#include <config.h>
#include "nautilus-tree-view-dnd.h"
#include <string.h>
#include <gtk/gtkdnd.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkscrolledwindow.h>
......@@ -39,6 +37,8 @@
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include "nautilus-tree-view-dnd.h"
/* This constant is zero because right now it does not seem we need
extra delay on horizontal-only auto-scroll. However, it's left in
so we can easily add this delay if we decide we want it. */
......@@ -296,8 +296,6 @@ nautilus_tree_view_drag_begin (GtkWidget *widget, GdkDragContext *context,
nautilus_tree_view_set_dnd_icon (tree_view, context);
}
static void
nautilus_tree_view_drag_end (GtkWidget *widget, GdkDragContext *context,
gpointer user_data)
......@@ -307,7 +305,6 @@ nautilus_tree_view_drag_end (GtkWidget *widget, GdkDragContext *context,
}
static void
nautilus_tree_view_drag_leave (GtkWidget *widget,
GdkDragContext *context,
......@@ -437,7 +434,6 @@ nautilus_tree_view_drag_drop (GtkWidget *widget,
return TRUE;
}
static void
nautilus_tree_view_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
......@@ -499,12 +495,12 @@ nautilus_tree_view_drag_data_received (GtkWidget *widget,
"drag_data_received");
}
static void nautilus_tree_view_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *data,
guint info, guint time,
gpointer user_data)
static void
nautilus_tree_view_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *data,
guint info, guint time,
gpointer user_data)
{
NautilusTreeView *tree_view;
char *uri, *selection_string;
......@@ -520,7 +516,8 @@ static void nautilus_tree_view_drag_data_get (GtkWidget *widget,
gtk_selection_data_set (data,
data->target,
8, selection_string, strlen(selection_string));
8, selection_string,
strlen (selection_string));
g_free (uri);
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget),
......@@ -528,26 +525,9 @@ static void nautilus_tree_view_drag_data_get (GtkWidget *widget,
}
/* --------------------------------------------------------------
standard gtk events: press/release/motion. used to start drags
--------------------------------------------------------------
*/
* standard gtk events: press/release/motion. used to start drags
* -------------------------------------------------------------- */
static int
nautilus_tree_view_button_press (GtkWidget *widget, GdkEventButton *event)
......@@ -698,8 +678,6 @@ nautilus_tree_view_button_release (GtkWidget *widget, GdkEventButton *event)
}
static int
nautilus_tree_view_motion_notify (GtkWidget *widget, GdkEventButton *event)
{
......@@ -748,29 +726,9 @@ nautilus_tree_view_motion_notify (GtkWidget *widget, GdkEventButton *event)
return TRUE;
}
/* -----------------------------------------------------------------------
helper functions
-----------------------------------------------------------------------
*/
* helper functions
* ----------------------------------------------------------------------- */
static void
nautilus_tree_view_set_dnd_icon (NautilusTreeView *tree_view, GdkDragContext *context)
......@@ -805,8 +763,6 @@ nautilus_tree_view_set_dnd_icon (NautilusTreeView *tree_view, GdkDragContext *co
#endif
}
/* returns if it was expanded or not */
static gboolean
nautilus_tree_view_collapse_node (EelCTree *tree, EelCTreeNode *node)
......@@ -832,7 +788,6 @@ nautilus_tree_view_collapse_node (EelCTree *tree, EelCTreeNode *node)
return is_expanded;
}
static void
nautilus_tree_view_expand_or_collapse_row (EelCTree *tree, int row)
{
......@@ -889,8 +844,6 @@ nautilus_tree_view_move_copy_files (NautilusTreeView *tree_view,
g_list_free (source_uris);
}
static char *
nautilus_tree_view_find_drop_target (NautilusTreeView *tree_view,
int x, int y)
......@@ -922,7 +875,6 @@ nautilus_tree_view_find_drop_target (NautilusTreeView *tree_view,
return target_uri;
}
static gboolean
nautilus_tree_view_is_tree_node_directory (NautilusTreeView *tree_view,
EelCTreeNode *node)
......@@ -940,8 +892,6 @@ nautilus_tree_view_is_tree_node_directory (NautilusTreeView *tree_view,
return is_directory;
}
static EelCTreeNode *
nautilus_tree_view_tree_node_at (NautilusTreeView *tree_view,
int x, int y)
......@@ -986,7 +936,6 @@ nautilus_tree_view_item_at (NautilusTreeView *tree_view,
return nautilus_file_get_uri (nautilus_tree_view_node_to_file (tree_view, node));
}
/**
* nautilus_tree_view_get_drag_uri:
* @tree_view: a %NautilusTreeView.
......@@ -1018,16 +967,10 @@ nautilus_tree_view_ensure_drag_data (NautilusTreeView *tree_view,
}
}
/***********************************************************************
* scrolling helper code. stolen and modified from nautilus-icon-dnd.c *
***********************************************************************/
static gboolean
ready_to_start_scrolling (EelDragInfo *drag_info,
int y_scroll_delta)
......@@ -1063,7 +1006,6 @@ auto_scroll_timeout_callback (gpointer data)
return TRUE;
}
static void
nautilus_tree_view_start_auto_scroll (NautilusTreeView *tree_view)
{
......@@ -1075,7 +1017,6 @@ nautilus_tree_view_start_auto_scroll (NautilusTreeView *tree_view)
tree_view);
}
static void
nautilus_tree_view_stop_auto_scroll (NautilusTreeView *tree_view)
{
......@@ -1096,7 +1037,6 @@ nautilus_tree_view_real_scroll (NautilusTreeView *tree_view, float delta_x, floa
eel_gtk_adjustment_set_value (vadj, vadj->value + delta_y);
}
/******************************************
* Handle the data dropped on the tree view
******************************************/
......@@ -1113,7 +1053,8 @@ nautilus_tree_view_get_drop_action (NautilusTreeView *tree_view,
drag_info = NAUTILUS_TREE_VIEW (tree_view)->details->dnd->drag_info;
/* FIXME bugzilla.gnome.org 42569: Too much code copied from nautilus-icon-dnd.c. Need to share more. */
/* FIXME bugzilla.gnome.org 42569: Too much code copied from
* nautilus-icon-dnd.c. Need to share more. */
if (!drag_info->got_drop_data_type) {
/* drag_data_received didn't get called yet */
......@@ -1162,19 +1103,17 @@ nautilus_tree_view_collapse_all (NautilusTreeView *tree_view,
list = tree_view->details->dnd->expanded_nodes;
for (temp_list = list; temp_list != NULL; temp_list = temp_list->next) {
EelCTreeNode *expanded_node;
expanded_node = (EelCTreeNode *) temp_list->data;
if (!eel_ctree_is_ancestor (EEL_CTREE (tree_view->details->tree),
expanded_node, current_node)) {
expanded_node, current_node)) {
nautilus_tree_view_collapse_node (EEL_CTREE (tree_view->details->tree),
expanded_node);
}
}
}
static void
nautilus_tree_view_receive_dropped_icons (NautilusTreeView *view,
GdkDragContext *context,
......@@ -1228,8 +1167,6 @@ nautilus_tree_view_receive_dropped_icons (NautilusTreeView *view,
}
}
static void
nautilus_tree_view_drag_destroy (NautilusTreeView *tree_view)
{
......@@ -1247,11 +1184,9 @@ nautilus_tree_view_drag_destroy (NautilusTreeView *tree_view)
nautilus_tree_view_stop_auto_scroll (tree_view);
/* remove prelighting */
eel_ctree_set_prelight (EEL_CTREE (tree_view->details->tree),
-1);
eel_ctree_set_prelight (EEL_CTREE (tree_view->details->tree), -1);
}
static void
nautilus_tree_view_drag_destroy_real (NautilusTreeView *tree_view)
{
......
......@@ -1004,38 +1004,33 @@ create_tree (NautilusTreeView *view)
}
static void
tree_map_callback (GtkWidget *widget,
gpointer callback_data)
tree_activate_callback (BonoboControl *control,
gboolean activating,
gpointer user_data)
{
NautilusTreeView *view;
view = NAUTILUS_TREE_VIEW (callback_data);
g_assert (widget == view->details->scrolled_window);
view = NAUTILUS_TREE_VIEW (user_data);
g_assert (view != NULL);
if (view->details->tree == NULL) {
create_tree (view);
if (activating) {
if (view->details->tree == NULL) {
create_tree (view);
}
nautilus_tree_model_set_defer_notifications (view->details->model, FALSE);
schedule_pending_idle_callback (view);
expand_uri_sequence_and_select_end (view);
} else {
nautilus_tree_model_set_defer_notifications (view->details->model, TRUE);
unschedule_pending_idle_callback (view);
}
nautilus_tree_model_set_defer_notifications (view->details->model, FALSE);
schedule_pending_idle_callback (view);
expand_uri_sequence_and_select_end (view);
}
static void
tree_unmap_callback (GtkWidget *widget,
gpointer callback_data)
{
NautilusTreeView *view;
view = NAUTILUS_TREE_VIEW (callback_data);
g_assert (widget == view->details->scrolled_window);
nautilus_tree_model_set_defer_notifications (view->details->model, TRUE);
unschedule_pending_idle_callback (view);
}
static void
nautilus_tree_view_init (NautilusTreeView *view)
{
BonoboControl *control;
view->details = g_new0 (NautilusTreeViewDetails, 1);
/* Obtain the filtering preferences */
......@@ -1049,29 +1044,23 @@ nautilus_tree_view_init (NautilusTreeView *view)
! eel_preferences_get_boolean (NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES);
g_signal_connect (view,
"load_location",
G_CALLBACK (tree_load_location_callback),
view);
"load_location",
G_CALLBACK (tree_load_location_callback),
view);
view->details->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (view->details->scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_show (view->details->scrolled_window);
nautilus_view_construct (NAUTILUS_VIEW (view),
view->details->scrolled_window);
control = bonobo_control_new (view->details->scrolled_window);
nautilus_view_construct_from_bonobo_control (NAUTILUS_VIEW (view), control);
g_signal_connect (view->details->scrolled_window,
"map",
G_CALLBACK (tree_map_callback),
view);
g_signal_connect (view->details->scrolled_window,
"unmap",
G_CALLBACK (tree_unmap_callback),
view);
g_signal_connect (control, "activate",
G_CALLBACK (tree_activate_callback), view);
}
static void
......@@ -1387,6 +1376,8 @@ tree_load_location_callback (NautilusView *nautilus_view,
NautilusTreeView *view)
{
g_assert (nautilus_view == NAUTILUS_VIEW (view));
g_warning ("Load tree!");
nautilus_view_report_load_complete (nautilus_view);
......
......@@ -7,4 +7,5 @@ VOID:DOUBLE
VOID:POINTER,INT,INT,INT
VOID:POINTER,POINTER
VOID:POINTER,POINTER
VOID:STRING,STRING
VOID:POINTER,POINTER,POINTER,INT,INT,INT
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment