Commit f683ed79 authored by Darin Adler's avatar Darin Adler
Browse files

reviewed by: Pavel Cisler <pavel@eazel.com>

	Fix bug 5235 ("Forget History" eliminates history from Go menu,
	not History sidebar panel).

	* components/history/nautilus-history-view.c:
	(install_icons): Fix leak of pixmap and bitmap.
	(update_history): Replaced dual lock system with a single one.
	(button_press_callback): Only respect button 1, ignore others.
	(button_release_callback): Only respect button 1, ignore others,
	(history_changed_callback): A new single callback for when the
	history list changes to replace the multiple callbacks before.
	(nautilus_history_view_initialize_class),
	(nautilus_history_view_initialize),
	(nautilus_history_view_destroy), (main): Change the history view
	to use nautilus_view_standard_main which requires a subclass. This
	gets rid of a lot of boilerplate code.

	* libnautilus/nautilus-view-component.idl: Make every NautilusView
	get an explicit history_changed call instead of requiring them to
	guess when to get history. Removed the old get_history_list call
	and also renamed the HistoryList sequence to History.
	* libnautilus/nautilus-view.h:
	* libnautilus/nautilus-view.c:
	(impl_Nautilus_View_history_changed),
	(nautilus_view_initialize_class): Added the necessary stuff to
	cover the new history_changed call.

	* src/nautilus-view-frame.h:
	* src/nautilus-view-frame.c: (nautilus_view_frame_initialize):
	Connect handlers so we can send history_changed calls to the
	NautilusView when either the history or the icons change.
	(nautilus_view_frame_destroy): Change state to EMPTY so the
	history signal won't be sent once the frame is destroyed.
	(view_frame_activated): Send a history_changed to every
	newly-activated view.
	(get_CORBA_object): Helper function to make code that makes CORBA
	calls simpler.
	(check_if_view_is_gone): Use get_CORBA_object.
	(attach_client): Gave a nicer name, removed the code that makes
	the Nautilus_HistoryFrame interface.
	(nautilus_view_frame_load_client): Do the attach_client (formerly
	nautilus_view_frame_set_to_component) before calling
	view_frame_activated. This is needed since view_frame_activated
	now sends a history_changed to the view.
	(nautilus_view_frame_load_location),
	(nautilus_view_frame_stop_loading),
	(nautilus_view_frame_selection_changed),
	(nautilus_view_frame_title_changed): Use get_CORBA_object.
	(get_history_list): Made this private.
	(send_history): Helper function that sends history to the view if
	it's in the appropriate state.

	* src/Makefile.am:
	* src/nautilus-history-frame.c:
	* src/nautilus-history-frame.h:
	Removed the old NautilusHistoryFrame, which is no longer needed
	since we put the history call right in the NautilusView class.

	* src/nautilus-window-manage-views.c: (get_history_list_callback):
	Updated for Nautilus_HistoryList -> Nautilus_History change.

	Fix bug 5391 ("Esc" Canceling of an icon stretch doesn't restore
	icon position.).

	* libnautilus-extensions/nautilus-icon-private.h:
	* libnautilus-extensions/nautilus-icon-container.c:
	(clear_drag_state): Add a single bottleneck function to make sure
	the context menu timeout always gets canceled.
	(continue_stretching): Remove the unused "update_position" parameter.
	(undo_stretching): Consolidate the cancel_stretching function and
	restore the icon's position as well as its size. Also use the new
	bottleneck to clear the drag state.
	(button_release_event): Use the new bottleneck to clear the drag
	state.
	(show_context_menu_callback): Use the new bottleneck to clear the
	drag state.
	(nautilus_icon_container_set_selection),
	(nautilus_icon_container_select_list_unselect_others): Take
	advantage of the defaults in g_hash_table_new and use NULL, NULL
	instead of g_direct_hash, g_direct_equal.
	(nautilus_icon_container_show_stretch_handles): Save the position
	as well as the size.
	(compute_stretch): Add a FIXME with a bug number.

	Fix bug 5407 (Make "Hardware Overview" title translatable).

	* components/hardware/nautilus-hardware-view.c:
	(nautilus_hardware_view_destroy): Remove unused uri field.
	(extract_info): Fix storage leak.
	(get_RAM_description): Get rid of code that non-portably relies on
	long long. Mark strings for translation.
	(get_IDE_description): Get rid of code that non-portably relies on
	long long. Mark strings for translation.
	(setup_overview_form): Marked string for translation.
	(setup_CPU_form), (setup_RAM_form), (setup_IDE_form),
	(is_location), (nautilus_hardware_view_load_uri): Disable the
	views other than the overview for now since they are not ready to
	be seen.
	(nautilus_hardware_view_drag_data_received): Get rid of the code
	that makes the hardware view accept a URI list drag.

	Fix bug 5405 (nautilus --check fails when using LC_ALL=sv_SE due
	to missing entry in POTFILES.in).

	* po/POTFILES.in: Added nautilus-glib-extensions.c.

	Other changes.

	* src/nautilus-signaller.h:
	* src/nautilus-signaller.c: (nautilus_signaller_initialize_class),
	(nautilus_signaller_get_current):
	Change the NautilusSignaller class so that the interface calls the
	object a GtkObject * and the details of the class are hidden.

	* src/nautilus-property-browser.c: (emit_emblems_changed_signal):
	* src/nautilus-search-bar-criterion.c:
	(nautilus_search_bar_criterion_destroy),
	(nautilus_search_bar_criterion_new_from_values):
	* src/nautilus-window-menus.c:
	(nautilus_window_initialize_go_menu):
	* src/nautilus-window.c: (nautilus_send_history_list_changed):
	Now that nautilus_signaller_get_current returns a GtkObject,
	remove some unnecessary casts.

	* components/html/glibwww-callbacks.c: (get_sock_info),
	(glibwww_timer_register):
	* components/tree/nautilus-tree-model.c:
	(nautilus_tree_model_initialize):
	* components/tree/nautilus-tree-view.c:
	(nautilus_tree_view_initialize):
	* libnautilus-extensions/nautilus-directory-async.c:
	(async_job_start):
	* libnautilus-extensions/nautilus-directory.c:
	(nautilus_directory_notify_files_added),
	(nautilus_directory_notify_files_removed),
	(nautilus_directory_notify_files_moved):
	* libnautilus-extensions/nautilus-icon-factory.c:
	(nautilus_icon_factory_initialize):
	* libnautilus-extensions/nautilus-list.c:
	(nautilus_list_set_selection):
	* libnautilus-extensions/nautilus-merged-directory.c:
	(nautilus_merged_directory_initialize):
	* libnautilus-extensions/nautilus-trash-directory.c:
	(nautilus_trash_directory_initialize):
	* src/file-manager/fm-properties-window.c:
	(fm_properties_window_present):
	Take advantage of the defaults in g_hash_table_new and use NULL,
	NULL instead of g_direct_hash, g_direct_equal.
parent ec540c3e
2001-01-03 Darin Adler <darin@eazel.com>
reviewed by: Pavel Cisler <pavel@eazel.com>
Fix bug 5235 ("Forget History" eliminates history from Go menu,
not History sidebar panel).
* components/history/nautilus-history-view.c:
(install_icons): Fix leak of pixmap and bitmap.
(update_history): Replaced dual lock system with a single one.
(button_press_callback): Only respect button 1, ignore others.
(button_release_callback): Only respect button 1, ignore others,
(history_changed_callback): A new single callback for when the
history list changes to replace the multiple callbacks before.
(nautilus_history_view_initialize_class),
(nautilus_history_view_initialize),
(nautilus_history_view_destroy), (main): Change the history view
to use nautilus_view_standard_main which requires a subclass. This
gets rid of a lot of boilerplate code.
* libnautilus/nautilus-view-component.idl: Make every NautilusView
get an explicit history_changed call instead of requiring them to
guess when to get history. Removed the old get_history_list call
and also renamed the HistoryList sequence to History.
* libnautilus/nautilus-view.h:
* libnautilus/nautilus-view.c:
(impl_Nautilus_View_history_changed),
(nautilus_view_initialize_class): Added the necessary stuff to
cover the new history_changed call.
* src/nautilus-view-frame.h:
* src/nautilus-view-frame.c: (nautilus_view_frame_initialize):
Connect handlers so we can send history_changed calls to the
NautilusView when either the history or the icons change.
(nautilus_view_frame_destroy): Change state to EMPTY so the
history signal won't be sent once the frame is destroyed.
(view_frame_activated): Send a history_changed to every
newly-activated view.
(get_CORBA_object): Helper function to make code that makes CORBA
calls simpler.
(check_if_view_is_gone): Use get_CORBA_object.
(attach_client): Gave a nicer name, removed the code that makes
the Nautilus_HistoryFrame interface.
(nautilus_view_frame_load_client): Do the attach_client (formerly
nautilus_view_frame_set_to_component) before calling
view_frame_activated. This is needed since view_frame_activated
now sends a history_changed to the view.
(nautilus_view_frame_load_location),
(nautilus_view_frame_stop_loading),
(nautilus_view_frame_selection_changed),
(nautilus_view_frame_title_changed): Use get_CORBA_object.
(get_history_list): Made this private.
(send_history): Helper function that sends history to the view if
it's in the appropriate state.
* src/Makefile.am:
* src/nautilus-history-frame.c:
* src/nautilus-history-frame.h:
Removed the old NautilusHistoryFrame, which is no longer needed
since we put the history call right in the NautilusView class.
* src/nautilus-window-manage-views.c: (get_history_list_callback):
Updated for Nautilus_HistoryList -> Nautilus_History change.
Fix bug 5391 ("Esc" Canceling of an icon stretch doesn't restore
icon position.).
* libnautilus-extensions/nautilus-icon-private.h:
* libnautilus-extensions/nautilus-icon-container.c:
(clear_drag_state): Add a single bottleneck function to make sure
the context menu timeout always gets canceled.
(continue_stretching): Remove the unused "update_position" parameter.
(undo_stretching): Consolidate the cancel_stretching function and
restore the icon's position as well as its size. Also use the new
bottleneck to clear the drag state.
(button_release_event): Use the new bottleneck to clear the drag
state.
(show_context_menu_callback): Use the new bottleneck to clear the
drag state.
(nautilus_icon_container_set_selection),
(nautilus_icon_container_select_list_unselect_others): Take
advantage of the defaults in g_hash_table_new and use NULL, NULL
instead of g_direct_hash, g_direct_equal.
(nautilus_icon_container_show_stretch_handles): Save the position
as well as the size.
(compute_stretch): Add a FIXME with a bug number.
Fix bug 5407 (Make "Hardware Overview" title translatable).
* components/hardware/nautilus-hardware-view.c:
(nautilus_hardware_view_destroy): Remove unused uri field.
(extract_info): Fix storage leak.
(get_RAM_description): Get rid of code that non-portably relies on
long long. Mark strings for translation.
(get_IDE_description): Get rid of code that non-portably relies on
long long. Mark strings for translation.
(setup_overview_form): Marked string for translation.
(setup_CPU_form), (setup_RAM_form), (setup_IDE_form),
(is_location), (nautilus_hardware_view_load_uri): Disable the
views other than the overview for now since they are not ready to
be seen.
(nautilus_hardware_view_drag_data_received): Get rid of the code
that makes the hardware view accept a URI list drag.
Fix bug 5405 (nautilus --check fails when using LC_ALL=sv_SE due
to missing entry in POTFILES.in).
* po/POTFILES.in: Added nautilus-glib-extensions.c.
Other changes.
* src/nautilus-signaller.h:
* src/nautilus-signaller.c: (nautilus_signaller_initialize_class),
(nautilus_signaller_get_current):
Change the NautilusSignaller class so that the interface calls the
object a GtkObject * and the details of the class are hidden.
* src/nautilus-property-browser.c: (emit_emblems_changed_signal):
* src/nautilus-search-bar-criterion.c:
(nautilus_search_bar_criterion_destroy),
(nautilus_search_bar_criterion_new_from_values):
* src/nautilus-window-menus.c:
(nautilus_window_initialize_go_menu):
* src/nautilus-window.c: (nautilus_send_history_list_changed):
Now that nautilus_signaller_get_current returns a GtkObject,
remove some unnecessary casts.
* components/html/glibwww-callbacks.c: (get_sock_info),
(glibwww_timer_register):
* components/tree/nautilus-tree-model.c:
(nautilus_tree_model_initialize):
* components/tree/nautilus-tree-view.c:
(nautilus_tree_view_initialize):
* libnautilus-extensions/nautilus-directory-async.c:
(async_job_start):
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_notify_files_added),
(nautilus_directory_notify_files_removed),
(nautilus_directory_notify_files_moved):
* libnautilus-extensions/nautilus-icon-factory.c:
(nautilus_icon_factory_initialize):
* libnautilus-extensions/nautilus-list.c:
(nautilus_list_set_selection):
* libnautilus-extensions/nautilus-merged-directory.c:
(nautilus_merged_directory_initialize):
* libnautilus-extensions/nautilus-trash-directory.c:
(nautilus_trash_directory_initialize):
* src/file-manager/fm-properties-window.c:
(fm_properties_window_present):
Take advantage of the defaults in g_hash_table_new and use NULL,
NULL instead of g_direct_hash, g_direct_equal.
2001-01-03 John Sullivan <sullivan@eazel.com>
 
reviewed by: Darin Adler <darin@eazel.com>
......@@ -91,7 +243,7 @@
 
2001-01-03 Ramiro Estrugo <ramiro@eazel.com>
 
reviewed by: Pavel Cisler<pavel@eazel.com>
reviewed by: Pavel Cisler <pavel@eazel.com>
 
* components/mozilla/nautilus-mozilla-content-view.c:
(file_exists), (ensure_profile_dir), (ensure_cache_dir),
......
......@@ -33,12 +33,11 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gnome.h>
#include <gtk/gtksignal.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnorba/gnorba.h>
#include <libnautilus-extensions/nautilus-background.h>
#include <libnautilus-extensions/nautilus-directory-background.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-font-factory.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
......@@ -52,28 +51,21 @@
#include <sys/stat.h>
#include <sys/types.h>
/* FIXME: Hardwired font size here. */
/* FIXME bugzilla.eazel.com 5408: Hardwired font size here. */
#define HARDWARE_FONT_SIZE 14
#define HARDWARE_TITLE_FONT_SIZE 24
struct _NautilusHardwareViewDetails {
char *uri;
NautilusView *nautilus_view;
GtkWidget *form;
};
enum {
TARGET_URI_LIST,
TARGET_COLOR,
TARGET_GNOME_URI_LIST
};
static GtkTargetEntry hardware_dnd_target_table[] = {
{ "text/uri-list", 0, TARGET_URI_LIST },
{ "application/x-color", 0, TARGET_COLOR },
{ "x-special/gnome-icon-list", 0, TARGET_GNOME_URI_LIST }
};
static void nautilus_hardware_view_drag_data_received (GtkWidget *widget,
......@@ -138,9 +130,10 @@ nautilus_hardware_view_initialize (NautilusHardwareView *hardware_view)
static void
nautilus_hardware_view_destroy (GtkObject *object)
{
NautilusHardwareView *hardware_view = NAUTILUS_HARDWARE_VIEW (object);
NautilusHardwareView *hardware_view;
hardware_view = NAUTILUS_HARDWARE_VIEW (object);
g_free (hardware_view->details->uri);
g_free (hardware_view->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
......@@ -154,7 +147,7 @@ nautilus_hardware_view_get_nautilus_view (NautilusHardwareView *hardware_view)
}
static char *
read_proc_info(const gchar* proc_filename)
read_proc_info (const char* proc_filename)
{
FILE *thisFile;
char *result;
......@@ -179,21 +172,23 @@ read_proc_info(const gchar* proc_filename)
/* utility routine to extract information from a string and add it to an XML node */
static char*
extract_info (gchar* data, const gchar *field_name, gint nth)
extract_info (char* data, const char *field_name, int nth)
{
int index;
char **info_array;
char *field_data = NULL;
/* parse the data into a string array */
info_array = g_strsplit(data, "\n", 32);
info_array = g_strsplit (data, "\n", 32);
/* iterate through the data isolating the field */
for (index = 0; index < 32; index++) {
if (info_array[index] == NULL)
if (info_array[index] == NULL) {
break;
}
if (nautilus_str_has_prefix(info_array[index], field_name)) {
if(nth>0) nth--;
else {
if (nth > 0) {
nth--;
} else {
field_data = info_array[index] + strlen(field_name);
field_data = strchr(field_data, ':') + 1;
field_data = g_strchug(field_data);
......@@ -203,10 +198,8 @@ extract_info (gchar* data, const gchar *field_name, gint nth)
}
/* add the requested node if the field was found */
if (field_data == NULL)
return NULL;
field_data = g_strdup(field_data);
g_strfreev(info_array);
field_data = g_strdup (field_data);
g_strfreev (info_array);
return field_data;
}
......@@ -235,7 +228,7 @@ get_CPU_description (int nth)
* "K" for file sizes as of this writing (although we use "MB"
* and "GB").
*/
if (model == NULL || speed == NULL || cache_size == NULL) {
result = NULL;
} else {
......@@ -256,11 +249,11 @@ get_CPU_description (int nth)
static char *
get_RAM_description (void)
{
char *temp_str, *num_str, *result;
char* proc_data;
GnomeVFSFileSize ram_size;
char *temp_str, *result;
char *proc_data;
gulong ram_size;
proc_data = read_proc_info("meminfo");
proc_data = read_proc_info ("meminfo");
temp_str = extract_info (proc_data, "MemTotal", 0);
if (temp_str == NULL || strlen (temp_str) < 3) {
......@@ -272,20 +265,16 @@ get_RAM_description (void)
temp_str[strlen(temp_str) - 3] = '\0';
ram_size = (strtoul (temp_str, NULL, 10) + 500) / 1000;
if (ram_size > 1000) {
num_str = g_strdup_printf ("%Lu GB", ram_size / 1000);
if (ram_size >= 1000) {
result = g_strdup_printf (_("%lu GB RAM"), ram_size / 1000);
} else {
num_str = g_strdup_printf ("%Lu MB", ram_size);
result = g_strdup_printf (_("%lu MB RAM"), ram_size);
}
g_free (temp_str);
g_free (proc_data);
result = g_strdup_printf (_("%s RAM"), num_str);
g_free (num_str);
return result;
}
......@@ -293,30 +282,30 @@ static char *
get_IDE_description (const char *device)
{
char *temp_str, *num_str, *result;
GString* string_data = g_string_new("");
GString *string_data = g_string_new("");
char *proc_file;
GnomeVFSFileSize capacity;
gulong capacity;
/* Read model information string */
proc_file = g_strdup_printf("%s/model", device);
temp_str = read_proc_info(proc_file);
temp_str[strlen(temp_str) - 1] = '\0';
g_string_append(string_data, temp_str);
g_free(temp_str);
g_free(proc_file);
proc_file = g_strdup_printf ("%s/model", device);
temp_str = read_proc_info (proc_file);
temp_str[strlen (temp_str) - 1] = '\0';
g_string_append (string_data, temp_str);
g_free (temp_str);
g_free (proc_file);
/* Read media type */
proc_file = g_strdup_printf("%s/media", device);
temp_str = read_proc_info(proc_file);
g_free(proc_file);
proc_file = g_strdup_printf ("%s/media", device);
temp_str = read_proc_info (proc_file);
g_free (proc_file);
/* If a hard disk, get the size */
if(!strcmp(temp_str, "disk\n")) {
g_free(temp_str);
if (strcmp (temp_str, "disk\n") == 0) {
g_free (temp_str);
proc_file = g_strdup_printf("%s/capacity", device);
temp_str = read_proc_info(proc_file);
temp_str[strlen(temp_str) - 1] = '\0';
proc_file = g_strdup_printf ("%s/capacity", device);
temp_str = read_proc_info (proc_file);
temp_str[strlen (temp_str) - 1] = '\0';
/* NOTE: this should be
* capacity = strtoul (...)
......@@ -325,7 +314,7 @@ get_IDE_description (const char *device)
* (512 bytes per sector)
*
* but with large disks we overflow an unsigned long, which is the
* the type that gnome_vfs uses.
* the type that gnome_vfs uses (Darin: Not true, gnome-vfs uses 64-bit integers).
*
* ALSO, in keeping with disk manufacturer convention, disk sizes
* are quoted in powers of 10 (i.e., MB is 10^6, GB is 10^9).
......@@ -336,18 +325,18 @@ get_IDE_description (const char *device)
*/
capacity = (512 * (strtoul (temp_str, NULL, 10) / 1000)) / 1000;
if (capacity > 1000) {
num_str = g_strdup_printf ("%Lu GB", capacity / 1000);
if (capacity >= 1000) {
num_str = g_strdup_printf (_("%lu GB"), capacity / 1000);
} else {
num_str = g_strdup_printf ("%Lu MB", capacity);
num_str = g_strdup_printf (_("%lu MB"), capacity);
}
g_string_append(string_data, "\n");
g_string_append(string_data, num_str);
g_free(temp_str);
g_free(proc_file);
g_string_append (string_data, "\n");
g_string_append (string_data, num_str);
g_free (temp_str);
g_free (proc_file);
} else {
g_free(temp_str);
g_free (temp_str);
}
result = string_data->str;
......@@ -360,7 +349,9 @@ get_IDE_description (const char *device)
/* shared utility to allocate a title for a form */
static void
setup_form_title (NautilusHardwareView *view, const char* image_name, const char* title_text)
setup_form_title (NautilusHardwareView *view,
const char *image_name,
const char *title_text)
{
GtkWidget *temp_widget;
char *file_name;
......@@ -373,8 +364,8 @@ setup_form_title (NautilusHardwareView *view, const char* image_name, const char
file_name = gnome_pixmap_file (image_name);
if (file_name != NULL) {
temp_widget = nautilus_image_new_from_file (file_name);
gtk_box_pack_start(GTK_BOX(temp_container), temp_widget, 0, 0, 8);
gtk_widget_show(temp_widget);
gtk_box_pack_start (GTK_BOX (temp_container), temp_widget, 0, 0, 8);
gtk_widget_show (temp_widget);
g_free (file_name);
}
}
......@@ -401,7 +392,8 @@ add_element_to_table (GtkWidget *table, GtkWidget *element, int element_index)
}
/* set up the widgetry for the overview page */
static void setup_overview_form (NautilusHardwareView *view)
static void
setup_overview_form (NautilusHardwareView *view)
{
char *file_name, *temp_text;
GtkWidget *temp_widget, *pixmap_widget, *temp_box;
......@@ -417,7 +409,7 @@ static void setup_overview_form (NautilusHardwareView *view)
gtk_widget_show(view->details->form);
/* set up the title */
setup_form_title (view, NULL, "Hardware Overview");
setup_form_title (view, NULL, _("Hardware Overview"));
/* allocate a table to hold the elements */
table = gtk_table_new (3, 3, FALSE);
......@@ -433,8 +425,8 @@ static void setup_overview_form (NautilusHardwareView *view)
file_name = nautilus_pixmap_file ("cpu.png");
temp_widget = nautilus_image_new_from_file (file_name);
gtk_box_pack_start(GTK_BOX(temp_box), temp_widget, 0, 0, 0);
gtk_widget_show(temp_widget);
gtk_box_pack_start (GTK_BOX (temp_box), temp_widget, 0, 0, 0);
gtk_widget_show (temp_widget);
g_free (file_name);
temp_widget = nautilus_label_new (temp_text);
......@@ -460,8 +452,8 @@ static void setup_overview_form (NautilusHardwareView *view)
temp_text = get_RAM_description ();
temp_widget = nautilus_label_new (temp_text);
nautilus_label_set_font_size (NAUTILUS_LABEL (temp_widget), HARDWARE_FONT_SIZE);
g_free(temp_text);
gtk_box_pack_start(GTK_BOX(temp_box), temp_widget, 0, 0, 0 );
g_free (temp_text);
gtk_box_pack_start (GTK_BOX (temp_box), temp_widget, 0, 0, 0 );
gtk_widget_show (temp_widget);
/* Set up ide devices : by Shane Butler <shane_b@bigfoot.com> */
......@@ -512,9 +504,12 @@ static void setup_overview_form (NautilusHardwareView *view)
}
}
#ifdef ENABLE_SUBVIEWS
/* set up the widgetry for the CPU page */
static void setup_CPU_form(NautilusHardwareView *view)
static void
setup_CPU_form(NautilusHardwareView *view)
{
char *message;
GtkWidget *temp_widget;
......@@ -538,7 +533,8 @@ static void setup_CPU_form(NautilusHardwareView *view)
/* set up the widgetry for the RAM page */
static void setup_RAM_form(NautilusHardwareView *view)
static void
setup_RAM_form(NautilusHardwareView *view)
{
char *message;
GtkWidget *temp_widget;
......@@ -562,7 +558,8 @@ static void setup_RAM_form(NautilusHardwareView *view)
/* set up the widgetry for the IDE page */
static void setup_IDE_form(NautilusHardwareView *view)
static void
setup_IDE_form(NautilusHardwareView *view)
{
char *message;
GtkWidget *temp_widget;
......@@ -586,43 +583,48 @@ static void setup_IDE_form(NautilusHardwareView *view)
/* utility for checking uri */
static gboolean is_location(char *document_str, const char *place_str)
static gboolean
is_location (const char *document_str, const char *place_str)
{
return document_str && !strncmp(document_str + 1, place_str, strlen(place_str));
return document_str && strncmp(document_str + 1, place_str, strlen (place_str)) == 0;
}
#endif /* ENABLE_SUBVIEWS */
/* load the uri by casing out on the path */
void
nautilus_hardware_view_load_uri (NautilusHardwareView *view, const char *uri)
{
char *document_name;
#ifdef ENABLE_SUBVIEWS
const char *document_name;
#endif
/* dispose of the old uri and copy the new one */
g_free (view->details->uri);
view->details->uri = g_strdup (uri);
/* dispose of any old form that was installed */
if (view->details->form != NULL) {
gtk_widget_destroy(view->details->form);
gtk_widget_destroy (view->details->form);
view->details->form = NULL;
}
#ifndef ENABLE_SUBVIEWS
setup_overview_form (view);
#else
/* extract the document part of the uri */
document_name = strchr(uri, ':');
document_name = strchr (uri, ':');
/* load the appropriate form, based on the uri and the registration state */
if (is_location(document_name, "overview")) {
setup_overview_form(view);
} else if (is_location(document_name, "CPU")) {
setup_CPU_form(view);
} else if (is_location(document_name, "RAM")) {
setup_RAM_form(view);
} else if (is_location(document_name, "IDE")) {
setup_IDE_form(view);
if (is_location (document_name, "overview")) {
setup_overview_form (view);
} else if (is_location (document_name, "CPU")) {
setup_CPU_form (view);
} else if (is_location (document_name, "RAM")) {
setup_RAM_form (view);
} else if (is_location (document_name, "IDE")) {
setup_IDE_form (view);
} else {
setup_overview_form(view); /* if we don't understand it, go to the overview */
setup_overview_form (view); /* if we don't understand it, go to the overview */
}
#endif
}
static void
......@@ -645,12 +647,6 @@ nautilus_hardware_view_drag_data_received (GtkWidget *widget, GdkDragContext *co
g_return_if_fail (NAUTILUS_IS_HARDWARE_VIEW (widget));
switch (info) {
case TARGET_GNOME_URI_LIST:
case TARGET_URI_LIST:
g_message ("dropped data on hardware_view: %s", selection_data->data);
break;
case TARGET_COLOR:
/* Let the background change based on the dropped color. */
nautilus_background_receive_dropped_color (nautilus_get_widget_background (widget),
......
......@@ -28,313 +28,275 @@
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-ui-util.h>
#include <gnome.h>
#include <libnautilus/libnautilus.h>
#include <libnautilus/nautilus-view-component.h>
#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h>
#include <gtk/gtkclist.h>
#include <gtk/gtkscrolledwindow.h>
#include <libnautilus-extensions/nautilus-bookmark.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-init.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <liboaf/liboaf.h>
#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus/nautilus-view-component.h>
#include <libnautilus/nautilus-view-standard-main.h>
#define NAUTILUS_TYPE_HISTORY_VIEW (nautilus_history_view_get_type ())
#define NAUTILUS_HISTORY_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_HISTORY_VIEW, NautilusHistoryView))
#define NAUTILUS_HISTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_HISTORY_VIEW, NautilusHistoryViewClass))
#define NAUTILUS_IS_HISTORY_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_HISTORY_VIEW))
#define NAUTILUS_IS_HISTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_HISTORY_VIEW))
typedef struct {
NautilusView *view;
Nautilus_HistoryFrame history_frame;
GtkCList *clist;
NautilusView parent;
GtkCList *list;
gboolean updating_history;
int press_row;
} NautilusHistoryView;
gint notify_count;
gint press_row;
} HistoryView;
typedef struct {
NautilusViewClass parent;
} NautilusHistoryViewClass;
#define HISTORY_VIEW_COLUMN_ICON 0
#define HISTORY_VIEW_COLUMN_NAME 1
#define HISTORY_VIEW_COLUMN_COUNT 2
static GtkType nautilus_history_view_get_type (void);