Commit 0dee7ad3 authored by Darin Adler's avatar Darin Adler

Changed warning switches. Fixed bugs found when opening an icon and

using the history buttons. Improved selection info display in status bar.
parent 84ae5f64
1999-12-15 Darin Adler <darin@eazel.com>
* configure.in: Turned "-Wshadow" and "-Wundef" off for now, since they
fire in some existing code.
* gnome-icon-container.c: (handle_icon_button_press): Null out the drag
variables before sending the activate signal. This makes activating an
icon with a double-click work without crashing.
* ntl-main.c: (main): Make critical and warning messages fatal if
NAUTILUS_DEBUG is set in the environment. Make sure you have a new
gnome-vfs that doesn't use g_warning for status messages.
* ntl-window-msgs.c: (nautilus_window_change_location_internal):
Made the history store away the current position as the new "previous"
instead of storing away the new position. This makes the forward and
back buttons work better.
* ntl-window.c: (nautilus_window_back, nautilus_window_fwd):
Had to make a corresponding change here after the change to the
history mechanism.
* fm-directory-view.c: (display_selection_info): Some fixes to the
selection info display: "file"/"files" was backwards, text said "in"
before the file size, and the display was not cleared when the
selection was made empty. I still see problems where the selection
info gets cleared when the window is lowered and then raised.
1999-12-15 Andy Hertzfeld <andy@eazel.com>
* my first change: changed ntl-window-state.c
......
......@@ -34,8 +34,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
CFLAGS="$CFLAGS \
-W -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
-Wnested-externs -Wpointer-arith \
-Wno-sign-compare -Wsign-promo -Wshadow \
-Wundef"
-Wno-sign-compare -Wsign-promo"
fi
if test "$GCC" = "yes" -a "$set_fatal_warnings" != "no"; then
echo "enable fatal warnings = $set_fatal_warnings"
......
......@@ -2254,26 +2254,31 @@ handle_icon_button_press (GnomeIconContainer *container,
}
if (event->type == GDK_2BUTTON_PRESS) {
/* Double clicking should *never* trigger a D&D action.
* We must clear this out before emitting the signal, because
* handling the activate signal might invalidate the drag_icon pointer.
*/
priv->drag_button = 0;
priv->drag_icon = NULL;
gtk_signal_emit (GTK_OBJECT (container),
signals[ACTIVATE],
icon->text, icon->data);
/* Double clicking should *never* trigger a D&D action. */
priv->drag_button = 0;
priv->drag_icon = NULL;
return TRUE;
}
if (event->button == 3) {
gtk_signal_emit (GTK_OBJECT (container),
signals[CONTEXT_CLICK],
icon->text, icon->data);
/* FIXME this means you cannot drag with right click. Instead,
we should setup a timeout and emit this signal if the
timeout expires without movement. */
priv->drag_button = 0;
priv->drag_icon = NULL;
gtk_signal_emit (GTK_OBJECT (container),
signals[CONTEXT_CLICK],
icon->text, icon->data);
return TRUE;
}
......
......@@ -2254,26 +2254,31 @@ handle_icon_button_press (GnomeIconContainer *container,
}
if (event->type == GDK_2BUTTON_PRESS) {
/* Double clicking should *never* trigger a D&D action.
* We must clear this out before emitting the signal, because
* handling the activate signal might invalidate the drag_icon pointer.
*/
priv->drag_button = 0;
priv->drag_icon = NULL;
gtk_signal_emit (GTK_OBJECT (container),
signals[ACTIVATE],
icon->text, icon->data);
/* Double clicking should *never* trigger a D&D action. */
priv->drag_button = 0;
priv->drag_icon = NULL;
return TRUE;
}
if (event->button == 3) {
gtk_signal_emit (GTK_OBJECT (container),
signals[CONTEXT_CLICK],
icon->text, icon->data);
/* FIXME this means you cannot drag with right click. Instead,
we should setup a timeout and emit this signal if the
timeout expires without movement. */
priv->drag_button = 0;
priv->drag_icon = NULL;
gtk_signal_emit (GTK_OBJECT (container),
signals[CONTEXT_CLICK],
icon->text, icon->data);
return TRUE;
}
......
......@@ -2254,26 +2254,31 @@ handle_icon_button_press (GnomeIconContainer *container,
}
if (event->type == GDK_2BUTTON_PRESS) {
/* Double clicking should *never* trigger a D&D action.
* We must clear this out before emitting the signal, because
* handling the activate signal might invalidate the drag_icon pointer.
*/
priv->drag_button = 0;
priv->drag_icon = NULL;
gtk_signal_emit (GTK_OBJECT (container),
signals[ACTIVATE],
icon->text, icon->data);
/* Double clicking should *never* trigger a D&D action. */
priv->drag_button = 0;
priv->drag_icon = NULL;
return TRUE;
}
if (event->button == 3) {
gtk_signal_emit (GTK_OBJECT (container),
signals[CONTEXT_CLICK],
icon->text, icon->data);
/* FIXME this means you cannot drag with right click. Instead,
we should setup a timeout and emit this signal if the
timeout expires without movement. */
priv->drag_button = 0;
priv->drag_icon = NULL;
gtk_signal_emit (GTK_OBJECT (container),
signals[CONTEXT_CLICK],
icon->text, icon->data);
return TRUE;
}
......
......@@ -27,8 +27,6 @@
#include <gnome.h>
#define FM_DEBUG(x)
#include <libnautilus/libnautilus.h>
#include <libnautilus/gnome-icon-container.h>
#include <libnautilus/gtkflist.h>
......@@ -37,6 +35,8 @@
#include "fm-icon-cache.h"
#include "fm-public-api.h"
#define FM_DEBUG(x)
#define DISPLAY_TIMEOUT_INTERVAL 500
......@@ -50,7 +50,7 @@ display_selection_info (FMDirectoryView *view,
{
GnomeVFSFileSize size;
guint count;
gchar *size_string, msg[32];
gchar *size_string, *msg;
GList *p;
Nautilus_StatusRequestInfo sri;
......@@ -65,6 +65,9 @@ display_selection_info (FMDirectoryView *view,
}
if (count == 0) {
memset(&sri, 0, sizeof(sri));
sri.status_string = "";
nautilus_view_client_request_status_change(NAUTILUS_VIEW_CLIENT(view), &sri);
return;
}
......@@ -96,11 +99,12 @@ display_selection_info (FMDirectoryView *view,
}
}
g_snprintf (msg, sizeof(msg), _("%d %s selected in %s"),
count, (count==1)?_("files"):_("file"), size_string);
msg = g_strdup_printf (_("%d %s selected -- %s"),
count, (count==1)?_("file"):_("files"), size_string);
memset(&sri, 0, sizeof(sri));
sri.status_string = msg;
nautilus_view_client_request_status_change(NAUTILUS_VIEW_CLIENT(view), &sri);
g_free (msg);
g_free (size_string);
}
......@@ -143,8 +147,6 @@ display_icon_container_selection_info_idle_cb (gpointer data)
GnomeIconContainer *icon_container;
GList *selection;
puts (__FUNCTION__);
view = FM_DIRECTORY_VIEW (data);
icon_container = get_icon_container (view);
......@@ -754,7 +756,8 @@ directory_load_cb (GnomeVFSAsyncHandle *handle,
}
}
if (view->current_position == GNOME_VFS_DIRECTORY_LIST_POSITION_NONE)
if (view->current_position == GNOME_VFS_DIRECTORY_LIST_POSITION_NONE
&& list)
view->current_position
= gnome_vfs_directory_list_get_position (list);
......
......@@ -74,6 +74,9 @@ int main(int argc, char *argv[])
};
GtkWidget *mainwin;
GnomeGenericFactory *gfact;
if (getenv("NAUTILUS_DEBUG"))
g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
orb = gnome_CORBA_init_with_popt_table("nautilus", VERSION, &argc, argv, options, 0, &ctx, GNORBA_INIT_SERVER_FUNC, &ev);
bonobo_init(orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
......
......@@ -583,10 +583,12 @@ nautilus_window_back (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_prev);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_prev->data;
nri.requested_uri = g_strdup(window->uris_prev->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, TRUE);
g_free(nri.requested_uri);
}
static void
......@@ -597,7 +599,11 @@ nautilus_window_fwd (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_next);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_next->data;
nri.requested_uri = g_strdup(window->uris_next->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, FALSE);
g_free(nri.requested_uri);
}
......@@ -583,10 +583,12 @@ nautilus_window_back (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_prev);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_prev->data;
nri.requested_uri = g_strdup(window->uris_prev->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, TRUE);
g_free(nri.requested_uri);
}
static void
......@@ -597,7 +599,11 @@ nautilus_window_fwd (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_next);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_next->data;
nri.requested_uri = g_strdup(window->uris_next->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, FALSE);
g_free(nri.requested_uri);
}
......@@ -583,10 +583,12 @@ nautilus_window_back (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_prev);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_prev->data;
nri.requested_uri = g_strdup(window->uris_prev->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, TRUE);
g_free(nri.requested_uri);
}
static void
......@@ -597,7 +599,11 @@ nautilus_window_fwd (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_next);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_next->data;
nri.requested_uri = g_strdup(window->uris_next->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, FALSE);
g_free(nri.requested_uri);
}
......@@ -83,29 +83,41 @@ nautilus_window_request_location_change(NautilusWindow *window,
static void
nautilus_window_change_location_internal(NautilusWindow *window, NautilusNavigationInfo *loci, gboolean is_back)
{
char *old_location;
CORBA_free(window->si); window->si = NULL;
if(is_back)
/* Maintain history lists. */
if (is_back)
{
window->uris_next = g_slist_prepend(window->uris_next, window->uris_prev->data);
window->uris_prev = g_slist_remove(window->uris_prev, window->uris_prev->data);
/* Going back. Remove one item from the prev list and add the current item to the next list. */
g_assert(window->uris_prev);
g_assert(!strcmp(window->uris_prev->data, loci->navinfo.requested_uri));
g_assert(window->ni);
window->uris_next = g_slist_prepend(window->uris_next, g_strdup(window->ni->requested_uri));
g_free(window->uris_prev->data);
window->uris_prev = g_slist_remove_link(window->uris_prev, window->uris_prev);
}
else
{
char *append_val;
if(window->uris_next && !strcmp(loci->navinfo.requested_uri, window->uris_next->data))
/* Going forward. Remove one item from the next if it's the same as the the request.
* Otherwise, clobber the entire next list.
*/
if (window->uris_next && !strcmp(loci->navinfo.requested_uri, window->uris_next->data))
{
append_val = window->uris_next->data;
window->uris_next = g_slist_remove(window->uris_next, window->uris_next->data);
g_free(window->uris_next->data);
window->uris_next = g_slist_remove_link(window->uris_next, window->uris_next);
}
else
{
append_val = g_strdup(loci->navinfo.requested_uri);
g_slist_foreach(window->uris_next, (GFunc)g_free, NULL);
g_slist_free(window->uris_next); window->uris_next = NULL;
}
if(append_val)
window->uris_prev = g_slist_prepend(window->uris_prev, append_val);
if (window->ni)
window->uris_prev = g_slist_prepend(window->uris_prev, g_strdup(window->ni->requested_uri));
}
gtk_widget_set_sensitive(window->btn_back, window->uris_prev?TRUE:FALSE);
......
......@@ -583,10 +583,12 @@ nautilus_window_back (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_prev);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_prev->data;
nri.requested_uri = g_strdup(window->uris_prev->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, TRUE);
g_free(nri.requested_uri);
}
static void
......@@ -597,7 +599,11 @@ nautilus_window_fwd (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_next);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_next->data;
nri.requested_uri = g_strdup(window->uris_next->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, FALSE);
g_free(nri.requested_uri);
}
......@@ -74,6 +74,9 @@ int main(int argc, char *argv[])
};
GtkWidget *mainwin;
GnomeGenericFactory *gfact;
if (getenv("NAUTILUS_DEBUG"))
g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
orb = gnome_CORBA_init_with_popt_table("nautilus", VERSION, &argc, argv, options, 0, &ctx, GNORBA_INIT_SERVER_FUNC, &ev);
bonobo_init(orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
......
......@@ -83,29 +83,41 @@ nautilus_window_request_location_change(NautilusWindow *window,
static void
nautilus_window_change_location_internal(NautilusWindow *window, NautilusNavigationInfo *loci, gboolean is_back)
{
char *old_location;
CORBA_free(window->si); window->si = NULL;
if(is_back)
/* Maintain history lists. */
if (is_back)
{
window->uris_next = g_slist_prepend(window->uris_next, window->uris_prev->data);
window->uris_prev = g_slist_remove(window->uris_prev, window->uris_prev->data);
/* Going back. Remove one item from the prev list and add the current item to the next list. */
g_assert(window->uris_prev);
g_assert(!strcmp(window->uris_prev->data, loci->navinfo.requested_uri));
g_assert(window->ni);
window->uris_next = g_slist_prepend(window->uris_next, g_strdup(window->ni->requested_uri));
g_free(window->uris_prev->data);
window->uris_prev = g_slist_remove_link(window->uris_prev, window->uris_prev);
}
else
{
char *append_val;
if(window->uris_next && !strcmp(loci->navinfo.requested_uri, window->uris_next->data))
/* Going forward. Remove one item from the next if it's the same as the the request.
* Otherwise, clobber the entire next list.
*/
if (window->uris_next && !strcmp(loci->navinfo.requested_uri, window->uris_next->data))
{
append_val = window->uris_next->data;
window->uris_next = g_slist_remove(window->uris_next, window->uris_next->data);
g_free(window->uris_next->data);
window->uris_next = g_slist_remove_link(window->uris_next, window->uris_next);
}
else
{
append_val = g_strdup(loci->navinfo.requested_uri);
g_slist_foreach(window->uris_next, (GFunc)g_free, NULL);
g_slist_free(window->uris_next); window->uris_next = NULL;
}
if(append_val)
window->uris_prev = g_slist_prepend(window->uris_prev, append_val);
if (window->ni)
window->uris_prev = g_slist_prepend(window->uris_prev, g_strdup(window->ni->requested_uri));
}
gtk_widget_set_sensitive(window->btn_back, window->uris_prev?TRUE:FALSE);
......
......@@ -583,10 +583,12 @@ nautilus_window_back (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_prev);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_prev->data;
nri.requested_uri = g_strdup(window->uris_prev->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, TRUE);
g_free(nri.requested_uri);
}
static void
......@@ -597,7 +599,11 @@ nautilus_window_fwd (GtkWidget *btn, NautilusWindow *window)
g_assert(window->uris_next);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = window->uris_next->data;
nri.requested_uri = g_strdup(window->uris_next->data);
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
nautilus_window_change_location(window, &nri, NULL, FALSE);
g_free(nri.requested_uri);
}
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