[Nautilus-list] more easy fixes
- From: Havoc Pennington <hp redhat com>
- To: nautilus-list eazel com
- Subject: [Nautilus-list] more easy fixes
- Date: 02 Nov 2001 00:48:36 -0500
Hi,
Getting to the end of the low-hanging fruit here. ;-)
Havoc
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4809
diff -u -p -u -r1.4809 ChangeLog
--- ChangeLog 2001/11/02 03:47:20 1.4809
+++ ChangeLog 2001/11/02 05:50:51
@@ -1,5 +1,44 @@
2001-11-01 Havoc Pennington <hp pobox com>
+ * libnautilus/nautilus-clipboard.c (select_all): remove GtkText
+ workaround (I'm also checking in a fix for the bug being worked
+ around)
+
+ * libnautilus-private/nautilus-bookmark.c
+ (nautilus_bookmark_menu_item_new): replace some PixmapMenuItem
+ with ImageMenuItem
+
+ * src/file-manager/fm-directory-view.c
+ (set_script_environment_variables): use
+ eel_gtk_window_get_geometry_string
+
+ * src/nautilus-zoom-control.c: just nuke the draw method, it ain't
+ coming back
+
+ * src/nautilus-window.c (set_initial_window_geometry): remove
+ gtk_window_set_policy() that was useless, and replace set_usize
+ with set_size_request.
+ (nautilus_window_constructed): remove menu_bar_no_resize_hack, I
+ have no idea what GTK bug it's talking about, neither does the
+ referenced bug report say, but if we see it
+ again we'll fix it. (plus it says the bug is unsigned math,
+ and GTK 2 pretty much did a global s/uint/int/, especially
+ in the size request/alloc code)
+
+ * src/nautilus-desktop-window.c (realize): just remove the
+ gnome_win_hints stuff, as the FIXME says, it's dead.
+ (realize): remove the set_decorations, set_functions, and
+ the move_resize, all cruft
+ (nautilus_desktop_window_init): simplify some cruft in here
+
+ * src/nautilus-bookmarks-window.c
+ (nautilus_bookmarks_window_save_geometry):
+ use eel_gtk_window_get_geometry_string
+
+ * src/nautilus-window.c (nautilus_window_save_geometry): ditto
+
+2001-11-01 Havoc Pennington <hp pobox com>
+
* src/nautilus-view-frame-corba.c: fix
EEL_DEFINE_BONOBO_BOILERPLATE call
Index: libnautilus/nautilus-clipboard.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus/nautilus-clipboard.c,v
retrieving revision 1.27
diff -u -p -u -r1.27 nautilus-clipboard.c
--- libnautilus/nautilus-clipboard.c 2001/10/24 17:23:34 1.27
+++ libnautilus/nautilus-clipboard.c 2001/11/02 05:50:52
@@ -136,21 +136,9 @@ clear_callback (BonoboUIComponent *ui,
static void
select_all (GtkEditable *editable)
-{
- int end;
-
- /* Workaround for bug in GtkText. It can't handle a -1
- * passed in to set_position.
- */
- end = -1;
-#if GNOME2_CONVERSION_COMPLETE
- if (GTK_IS_TEXT (editable)) {
- end = gtk_text_get_length (GTK_TEXT (editable));
- }
-#endif
-
- gtk_editable_set_position (editable, end);
- gtk_editable_select_region (editable, 0, end);
+{
+ gtk_editable_set_position (editable, -1);
+ gtk_editable_select_region (editable, 0, -1);
}
static gboolean
Index: libnautilus-private/nautilus-bookmark.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-bookmark.c,v
retrieving revision 1.42
diff -u -p -u -r1.42 nautilus-bookmark.c
--- libnautilus-private/nautilus-bookmark.c 2001/10/28 20:21:43 1.42
+++ libnautilus-private/nautilus-bookmark.c 2001/11/02 05:50:52
@@ -32,7 +32,7 @@
#include <eel/eel-string.h>
#include <eel/eel-vfs-extensions.h>
#include <gtk/gtkaccellabel.h>
-#include <gtk/gtksignal.h>
+#include <gtk/gtkimagemenuitem.h>
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
@@ -564,24 +564,15 @@ nautilus_bookmark_menu_item_new (Nautilu
GtkWidget *pixmap_widget;
GtkWidget *label;
char *display_name;
-
- /* Could check gnome_preferences_get_menus_have_icons here, but these
- * are more important than stock menu icons, since they're connected to
- * user data. For now let's not let them be turn-offable and see if
- * anyone objects strenuously.
- */
-#if GNOME2_CONVERSION_COMPLETE
- menu_item = gtk_pixmap_menu_item_new ();
-#else
- menu_item = NULL;
-#endif
+
+ menu_item = gtk_image_menu_item_new ();
pixmap_widget = create_pixmap_widget_for_bookmark (bookmark);
if (pixmap_widget != NULL) {
gtk_widget_show (pixmap_widget);
-#if GNOME2_CONVERSION_COMPLETE
- gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menu_item), pixmap_widget);
-#endif
+
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), \
+ pixmap_widget);
}
display_name = eel_truncate_text_for_menu_item (bookmark->details->name);
label = gtk_label_new (display_name);
Index: src/nautilus-bookmarks-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-bookmarks-window.c,v
retrieving revision 1.49
diff -u -p -u -r1.49 nautilus-bookmarks-window.c
--- src/nautilus-bookmarks-window.c 2001/11/02 03:47:29 1.49
+++ src/nautilus-bookmarks-window.c 2001/11/02 05:50:52
@@ -350,13 +350,12 @@ nautilus_bookmarks_window_save_geometry
/* Don't bother if window is already closed */
if (GTK_WIDGET_VISIBLE (window)) {
-#if GNOME2_CONVERSION_COMPLETE
char *geometry_string;
- geometry_string = gnome_geometry_string (GTK_WIDGET (window)->window);
+ geometry_string = eel_gtk_window_get_geometry_string (window);
+
nautilus_bookmark_list_set_window_geometry (bookmarks, geometry_string);
g_free (geometry_string);
-#endif
}
}
Index: src/nautilus-desktop-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-desktop-window.c,v
retrieving revision 1.42
diff -u -p -u -r1.42 nautilus-desktop-window.c
--- src/nautilus-desktop-window.c 2001/10/30 19:31:54 1.42
+++ src/nautilus-desktop-window.c 2001/11/02 05:50:52
@@ -71,30 +71,17 @@ nautilus_desktop_window_init (NautilusDe
{
window->details = g_new0 (NautilusDesktopWindowDetails, 1);
- /* FIXME bugzilla.gnome.org 41251:
- * Although Havoc had this call to set_default_size in
- * his code, it seems to have no effect for me. But the
- * set_usize below does seem to work.
- */
- gtk_window_set_default_size (GTK_WINDOW (window),
+ gtk_widget_set_size_request (GTK_WIDGET (window),
gdk_screen_width (),
gdk_screen_height ());
- /* These calls seem to have some effect, but it's not clear if
- * they are the right thing to do.
- */
- gtk_widget_set_uposition (GTK_WIDGET (window), 0, 0);
- gtk_widget_set_usize (GTK_WIDGET (window),
- gdk_screen_width (),
- gdk_screen_height ());
-
- /* Tell the window manager to never resize this. This is not
- * known to have any specific beneficial effect with any
- * particular window manager for the case of the desktop
- * window, but it doesn't seem to do any harm.
+ gtk_window_move (GTK_WINDOW (window), 0, 0);
+
+ /* shouldn't really be needed given our semantic type
+ * of _NET_WM_TYPE_DESKTOP, but why not
*/
- gtk_window_set_policy (GTK_WINDOW (window),
- FALSE, FALSE, FALSE);
+ gtk_window_set_resizable (GTK_WINDOW (window),
+ FALSE);
}
static void
@@ -295,51 +282,6 @@ realize (GtkWidget *widget)
/* This is the new way to set up the desktop window */
set_wmspec_desktop_hint (widget->window);
-
-#if GNOME2_CONVERSION_COMPLETE
- /* FIXME all this gnome_win_hints stuff is legacy cruft */
-
- /* Put this window behind all the others. */
- gnome_win_hints_set_layer (widget, WIN_LAYER_DESKTOP);
-
- /* Make things like the task list ignore this window and make
- * it clear that it it's at its full size.
- *
- * We originally included WIN_STATE_HIDDEN here, but IceWM
- * interprets that (wrongly, imho) as meaning `don't display
- * this window'. Not including this bit seems to make
- * no difference though, so..
- */
- gnome_win_hints_set_state (widget,
- WIN_STATE_STICKY
- | WIN_STATE_MAXIMIZED_VERT
- | WIN_STATE_MAXIMIZED_HORIZ
- | WIN_STATE_FIXED_POSITION
- | WIN_STATE_ARRANGE_IGNORE);
-
- /* Make sure that focus, and any window lists or task bars also
- * skip the window.
- */
- gnome_win_hints_set_hints (widget,
- WIN_HINTS_SKIP_WINLIST
- | WIN_HINTS_SKIP_TASKBAR
- | WIN_HINTS_SKIP_FOCUS);
-#endif
-
- /* FIXME bugzilla.gnome.org 41255:
- * Should we do a gdk_window_move_resize here, in addition to
- * the calls in initialize above that set the size?
- */
- gdk_window_move_resize (widget->window,
- 0, 0,
- gdk_screen_width (),
- gdk_screen_height ());
-
- /* Get rid of the things that window managers add to resize
- * and otherwise manipulate the window.
- */
- gdk_window_set_decorations (widget->window, 0);
- gdk_window_set_functions (widget->window, 0);
}
static void
Index: src/nautilus-window-menus.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-menus.c,v
retrieving revision 1.205
diff -u -p -u -r1.205 nautilus-window-menus.c
--- src/nautilus-window-menus.c 2001/10/30 19:31:59 1.205
+++ src/nautilus-window-menus.c 2001/11/02 05:50:52
@@ -371,7 +371,7 @@ forget_history_if_confirmed (NautilusWin
_("Cancel"),
GTK_WINDOW (window));
g_free (prompt);
-
+
#if GNOME2_CONVERSION_COMPLETE
gtk_signal_connect
(GTK_OBJECT (eel_gnome_dialog_get_button_by_index
Index: src/nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.345
diff -u -p -u -r1.345 nautilus-window.c
--- src/nautilus-window.c 2001/11/01 01:24:25 1.345
+++ src/nautilus-window.c 2001/11/02 05:50:53
@@ -506,92 +506,32 @@ set_initial_window_geometry (NautilusWin
* is evil. So we choose semi-arbitrary initial and
* minimum widths instead of letting GTK decide.
*/
-
+ /* FIXME - the above comment suggests that the size request
+ * of the content view area is wrong, probably because of
+ * another stupid set_usize someplace. If someone gets the
+ * content view area's size request right then we can
+ * probably remove this broken set_size_request() here.
+ * - hp redhat com
+ */
+
max_width_for_screen = get_max_forced_width ();
max_height_for_screen = get_max_forced_height ();
- gtk_widget_set_usize (GTK_WIDGET (window),
- MIN (NAUTILUS_WINDOW_MIN_WIDTH,
- max_width_for_screen),
- MIN (NAUTILUS_WINDOW_MIN_HEIGHT,
- max_height_for_screen));
+ gtk_widget_set_size_request (GTK_WIDGET (window),
+ MIN (NAUTILUS_WINDOW_MIN_WIDTH,
+ max_width_for_screen),
+ MIN (NAUTILUS_WINDOW_MIN_HEIGHT,
+ max_height_for_screen));
gtk_window_set_default_size (GTK_WINDOW (window),
MIN (NAUTILUS_WINDOW_DEFAULT_WIDTH,
max_width_for_screen),
MIN (NAUTILUS_WINDOW_DEFAULT_HEIGHT,
max_height_for_screen));
-
- gtk_window_set_policy (GTK_WINDOW (window),
- FALSE, /* don't let window be stretched
- smaller than usize */
- TRUE, /* do let the window be stretched
- larger than default size */
- FALSE); /* don't shrink the window
- automatically to fit contents */
-
}
#if GNOME2_CONVERSION_COMPLETE
-static void
-menu_bar_no_resize_hack_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- /* do nothing */
-}
-
-static void
-menu_bar_no_resize_hack_menu_bar_finder (GtkWidget *child, gpointer data)
-{
- if (GTK_IS_MENU_BAR (child)) {
- * (GtkObject **) data = GTK_OBJECT (child);
- }
-}
-
-/* Since there's only one desktop at a time, we can keep track
- * of our faux-class with a single static.
- */
-static GtkObjectClass *menu_bar_no_resize_hack_class;
-
-static void
-menu_bar_no_resize_hack_class_free (void)
-{
- g_free (menu_bar_no_resize_hack_class);
-}
-
-/* This call is used to keep the desktop menu bar from resizing.
- * It patches out its class with one where the size_allocate
- * method has been replaced with a no-op.
- */
-static void
-menu_bar_no_resize_hack (NautilusWindow *window)
-{
- GtkObject *menu_bar;
- GtkTypeQuery *type_query;
-
- menu_bar = NULL;
-
- eel_gtk_container_foreach_deep (GTK_CONTAINER (window),
- menu_bar_no_resize_hack_menu_bar_finder,
- &menu_bar);
-
- g_return_if_fail (menu_bar != NULL);
-
- if (menu_bar_no_resize_hack_class == NULL) {
- g_atexit (menu_bar_no_resize_hack_class_free);
- }
-
- type_query = gtk_type_query (menu_bar->klass->type);
- g_free (menu_bar_no_resize_hack_class);
- menu_bar_no_resize_hack_class = g_memdup (menu_bar->klass, type_query->class_size);
- g_free (type_query);
-
- ((GtkWidgetClass *) menu_bar_no_resize_hack_class)->size_allocate
- = menu_bar_no_resize_hack_size_allocate;
-
- menu_bar->klass = menu_bar_no_resize_hack_class;
-}
-
static gboolean
location_change_at_idle_callback (gpointer callback_data)
{
@@ -787,14 +727,6 @@ nautilus_window_constructed (NautilusWin
STATUS_BAR_PATH, TRUE);
nautilus_bonobo_set_hidden (window->details->shell_ui,
MENU_BAR_PATH, TRUE);
-
-#if GNOME2_CONVERSION_COMPLETE
- /* FIXME bugzilla.gnome.org 44752:
- * If we ever get the unsigned math errors in
- * gtk_menu_item_size_allocate fixed this can be removed.
- */
- menu_bar_no_resize_hack (window);
-#endif
}
/* Wrap the location bar in a control and set it up. */
@@ -1012,19 +944,18 @@ nautilus_window_destroy (GtkObject *obje
static void
nautilus_window_save_geometry (NautilusWindow *window)
{
-#if GNOME2_CONVERSION_COMPLETE
char *geometry_string;
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
g_return_if_fail (GTK_WIDGET_VISIBLE (window));
- geometry_string = gnome_geometry_string (GTK_WIDGET (window)->window);
+ geometry_string = eel_gtk_window_get_geometry_string (GTK_WINDOW (window));
+
nautilus_file_set_metadata (window->details->viewed_file,
NAUTILUS_METADATA_KEY_WINDOW_GEOMETRY,
NULL,
geometry_string);
g_free (geometry_string);
-#endif
}
void
Index: src/nautilus-zoom-control.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-zoom-control.c,v
retrieving revision 1.53
diff -u -p -u -r1.53 nautilus-zoom-control.c
--- src/nautilus-zoom-control.c 2001/10/30 19:32:01 1.53
+++ src/nautilus-zoom-control.c 2001/11/02 05:50:53
@@ -344,26 +344,6 @@ draw_zoom_control_image (GtkWidget *widg
}
}
-#if GNOME2_CONVERSION_COMPLETE
-
-static void
-nautilus_zoom_control_draw (GtkWidget *widget, GdkRectangle *box)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (NAUTILUS_IS_ZOOM_CONTROL (widget));
-
- /* Clear the widget get the default widget background before drawing our stuff */
- gdk_window_clear_area (widget->window,
- 0,
- 0,
- widget->allocation.width,
- widget->allocation.height);
- draw_zoom_control_image (widget, box);
- draw_number (widget, box);
-}
-
-#endif
-
/* handle expose events */
static int
@@ -740,9 +720,6 @@ nautilus_zoom_control_class_init (Nautil
object_class->destroy = nautilus_zoom_control_destroy;
-#if GNOME2_CONVERSION_COMPLETE
- widget_class->draw = nautilus_zoom_control_draw;
-#endif
widget_class->expose_event = nautilus_zoom_control_expose;
widget_class->button_press_event = nautilus_zoom_control_button_press_event;
widget_class->leave_notify_event = nautilus_zoom_control_leave_notify;
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.476
diff -u -p -u -r1.476 fm-directory-view.c
--- src/file-manager/fm-directory-view.c 2001/11/02 03:47:33 1.476
+++ src/file-manager/fm-directory-view.c 2001/11/02 05:50:54
@@ -3545,9 +3545,7 @@ set_script_environment_variables (FMDire
char *file_paths;
char *uris;
char *uri;
-#if GNOME2_CONVERSION_COMPLETE
char *geometry_string;
-#endif
if (nautilus_directory_is_local (view->details->model)) {
file_paths = get_file_paths_as_newline_delimited_string (selected_files);
@@ -3565,12 +3563,10 @@ set_script_environment_variables (FMDire
eel_setenv ("NAUTILUS_SCRIPT_CURRENT_URI", uri, TRUE);
g_free (uri);
-#if GNOME2_CONVERSION_COMPLETE
- geometry_string = gnome_geometry_string
- (GTK_WIDGET (fm_directory_view_get_containing_window (view))->window);
+ geometry_string = eel_gtk_window_get_geometry_string
+ (GTK_WINDOW (fm_directory_view_get_containing_window (view)));
eel_setenv ("NAUTILUS_SCRIPT_WINDOW_GEOMETRY", geometry_string, TRUE);
g_free (geometry_string);
-#endif
}
/* Unset all the special script environment variables. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]