Browse Source

Metadata-aware Midnight Commander. WEEEcvs update . 1998-12-04 Miguel de Icaza <miguel@nuclecu.unam.mx>

	* gscreen.c (load_imlib_icons): Make it use the new gicon files.

	* gicon.c, gicon.h: New files: they keep an image cache and
	provide the right icon to use based on the filename.  They use the
	GNOME metadata to fecth the "icon-filename" and "icon-inline-png"
	keys.

	* gdialogs.c (file_mask_dialog): Commented the help messages until
	the warnings are figured out.
Miguel de Icaza 26 years ago
parent
commit
4a72b02987
7 changed files with 49 additions and 72 deletions
  1. 12 0
      gnome/ChangeLog
  2. 8 3
      gnome/Makefile.in
  3. 4 0
      gnome/gdialogs.c
  4. 4 3
      gnome/gdnd.c
  5. 3 60
      gnome/gscreen.c
  6. 3 1
      gnome/gtkdtree.c
  7. 15 5
      gnome/gview.c

+ 12 - 0
gnome/ChangeLog

@@ -1,3 +1,15 @@
+1998-12-04  Miguel de Icaza  <miguel@nuclecu.unam.mx>
+
+	* gscreen.c (load_imlib_icons): Make it use the new gicon files. 
+
+	* gicon.c, gicon.h: New files: they keep an image cache and
+	provide the right icon to use based on the filename.  They use the
+	GNOME metadata to fecth the "icon-filename" and "icon-inline-png"
+	keys.
+
+	* gdialogs.c (file_mask_dialog): Commented the help messages until
+	the warnings are figured out. 
+
 1998-12-04  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
 	* gdesktop.c (desktop_icon_info_new): Connect the signals for DnD

+ 8 - 3
gnome/Makefile.in

@@ -5,7 +5,7 @@ rootdir = $(srcdir)/..
 @MCFG@@MCF@
 
 GNOMEDEFS     = -DHAVE_X -DHAVE_GNOME @GNOME_INCLUDEDIR@ 
-CFLAGS        = $(XCFLAGS) @X_CFLAGS@
+CFLAGS        = -g $(XCFLAGS) @X_CFLAGS@
 CPPFLAGS      = $(XCPPFLAGS) -I$(vfsdir) -I$(slangdir) $(GNOMEDEFS)
 LDFLAGS       = $(XLDFLAGS) @GNOME_LIBDIR@ @GNOMEUI_LIBS@
 CORBA_LDFLAGS = $(XLDFLAGS) @GNOME_LIBDIR@ @GNOMEGNORBA_LIBS@
@@ -35,6 +35,7 @@ GNOMESRCS = 		\
 	gdesktop.c 	\
 	gdnd.c		\
 	ghelp.c 	\
+	gicon.c		\
 	ginfo.c 	\
 	gkey.c 		\
 	glayout.c 	\
@@ -63,6 +64,7 @@ GNOMEHDRS = 		\
 	gdesktop-icon.h	\
 	gdesktop.h	\
 	gdnd.h		\
+	gicon.h		\
 	gmain.h 	\
 	gmc-chargrid.h	\
 	gmetadata.h	\
@@ -80,10 +82,12 @@ ICONS = 			\
 	i-directory.png		\
 	i-executable.png	\
 	i-symlink.png		\
-	i-device.png		\
 	i-regular.png		\
 	i-core.png		\
-	i-sock.png
+	i-sock.png		\
+	i-chardev.png		\
+	i-blockdev.png		\
+	i-stalled.png
 
 #
 # These objects from ../src do not depend on HAVE_X / HAVE_GNOME??
@@ -118,6 +122,7 @@ OBJS = 			\
 	gdesktop.o 	\
 	gdnd.o		\
 	ghelp.o 	\
+	gicon.o		\
 	ginfo.o 	\
 	gkey.o 		\
 	glayout.o 	\

+ 4 - 0
gnome/gdialogs.c

@@ -210,9 +210,11 @@ file_mask_dialog (FileOperation operation, char *text, char *def_text, int only_
         cbox = gtk_check_button_new_with_label (N_("Copy as a background process"));
         gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (cbox), *do_background);
         gtk_signal_connect (GTK_OBJECT (cbox), "toggled", (GtkSignalFunc) fmd_check_box_callback, do_background);
+#if 0
         gnome_widget_add_help (cbox, "Selecting this will run the copying in the background.  "
                                "This is useful for transfers over networks that might take a long "
                                "time to complete.");
+#endif
         gtk_box_pack_end (GTK_BOX (vbox), cbox, FALSE, FALSE, 0);
         gtk_box_pack_end (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, 0);
         gtk_box_pack_end (GTK_BOX (vbox), fentry, FALSE, FALSE, 0);
@@ -232,7 +234,9 @@ file_mask_dialog (FileOperation operation, char *text, char *def_text, int only_
         cbox = gtk_check_button_new_with_label (N_("Preserve symlinks"));
         gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (cbox), file_mask_stable_symlinks);
         gtk_signal_connect (GTK_OBJECT (cbox), "toggled", (GtkSignalFunc) fmd_check_box_callback, &file_mask_stable_symlinks);
+#if 0
         gnome_widget_add_help (cbox, "FIXME: Add something here Miguel");
+#endif
         gtk_box_pack_start (GTK_BOX (vbox), cbox, FALSE, FALSE, 0);
 
 

+ 4 - 3
gnome/gdnd.c

@@ -70,7 +70,7 @@ find_panel_owning_window (GdkDragContext *context)
 {
 	GList *list;
 	WPanel *panel;
-	GtkWidget *source_widget;
+	GtkWidget *source_widget, *toplevel_widget;
 
 	source_widget = gtk_drag_get_source_widget (context);
 	if (!source_widget)
@@ -82,7 +82,7 @@ find_panel_owning_window (GdkDragContext *context)
 	 * widget for each WPanel and compare this to the
 	 * toplevel source_widget
 	 */
-	source_widget = gtk_widget_get_toplevel (source_widget);
+	toplevel_widget = gtk_widget_get_toplevel (source_widget);
 
 	for (list = containers; list; list = list->next) {
 		GtkWidget *panel_toplevel_widget;
@@ -91,7 +91,7 @@ find_panel_owning_window (GdkDragContext *context)
 
 		panel_toplevel_widget = panel->xwindow;
 
-		if (panel->xwindow == source_widget){
+		if (panel->xwindow == toplevel_widget){
 
 			/*
 			 * Now a WPanel actually contains a number of
@@ -267,6 +267,7 @@ gdnd_drop_on_directory (GdkDragContext *context, GtkSelectionData *selection_dat
 	/* If we are dragging from a file panel, we can display a nicer status display */
 	source_panel = find_panel_owning_window (context);
 
+	printf ("Panel found for this source: %p\n", source_panel);
 	/* Symlinks do not use file.c */
 
 	if (source_panel && action != GDK_ACTION_LINK)

+ 3 - 60
gnome/gscreen.c

@@ -43,6 +43,7 @@
 #include "dev.xpm"
 #include "listing-list.xpm"
 #include "listing-iconic.xpm"
+
 /* This is used to initialize our pixmaps */
 static int pixmaps_ready;
 GdkPixmap *icon_directory_pixmap;
@@ -52,15 +53,6 @@ GdkBitmap *icon_link_mask;
 GdkPixmap *icon_dev_pixmap;
 GdkBitmap *icon_dev_mask;
 
-/* These are big images used in the Icon View,  for the gnome_icon_list */
-static GdkImlibImage *icon_view_directory;
-static GdkImlibImage *icon_view_executable;
-static GdkImlibImage *icon_view_symlink;
-static GdkImlibImage *icon_view_device;
-static GdkImlibImage *icon_view_regular;
-static GdkImlibImage *icon_view_core;
-static GdkImlibImage *icon_view_sock;
-
 static GtkTargetEntry drag_types [] = {
 	{ "text/uri-list", 0, TARGET_URI_LIST },
 	{ "text/plain",    0, TARGET_TEXT_PLAIN }
@@ -218,37 +210,7 @@ panel_fill_panel_icons (WPanel *panel)
 	for (i = 0; i < top; i++){
 		file_entry *fe = &panel->dir.list [i];
 
-		
-		switch (file_entry_color (fe)){
-		case DIRECTORY_COLOR:
-			image = icon_view_directory;
-			break;
-			
-		case LINK_COLOR:
-			image = icon_view_symlink;
-			break;
-			
-		case DEVICE_COLOR:
-			image = icon_view_device;
-			break;
-			
-		case SPECIAL_COLOR:
-			image = icon_view_sock;
-			break;
-			
-		case EXECUTABLE_COLOR:
-			image = icon_view_executable;
-			break;
-				
-		case CORE_COLOR:
-			image = icon_view_core;
-			break;
-			
-		case STALLED_COLOR:
-		case NORMAL_COLOR:
-		default:
-			image = icon_view_regular;
-		}
+		image = gicon_get_icon_for_file (fe);
 		gnome_icon_list_append_imlib (icons, image, fe->fname);
 	}
 	/* This is needed as the gtk_clist_append changes selected under us :-( */
@@ -1056,17 +1018,6 @@ panel_icon_renamed (GtkWidget *widget, int index, char *dest, WPanel *panel)
 		return FALSE;
 }
 
-static GdkImlibImage *
-load_image_icon_view (char *base)
-{
-	GdkImlibImage *im;
-	char *f = concat_dir_and_file (ICONDIR, base);
-
-	im = gdk_imlib_load_image (f);
-	g_free (f);
-	return im;
-}
-
 static void
 load_imlib_icons (void)
 {
@@ -1075,14 +1026,6 @@ load_imlib_icons (void)
 	if (loaded)
 		return;
 	
-	icon_view_directory  = load_image_icon_view ("i-directory.png");
-	icon_view_executable = load_image_icon_view ("i-executable.png");
-	icon_view_symlink    = load_image_icon_view ("i-symlink.png");
-	icon_view_device     = load_image_icon_view ("i-device.png");
-	icon_view_regular    = load_image_icon_view ("i-regular.png");
-	icon_view_core       = load_image_icon_view ("i-core.png");
-	icon_view_sock       = load_image_icon_view ("i-sock.png");
-
 	loaded = 1;
 }
 
@@ -1580,7 +1523,7 @@ panel_tree_scroll (gpointer data)
 	else{
 		gtk_adjustment_set_value (va, va->value + va->step_increment);
 	}
-	return FALSE;
+	return TRUE;
 }
 
 /** 

+ 3 - 1
gnome/gtkdtree.c

@@ -281,6 +281,8 @@ gtk_dtree_do_select_dir (GtkDTree *dtree, char *path)
 		
 		if (node){
 			gtk_ctree_expand (GTK_CTREE (dtree), node);
+			while (gtk_events_pending ())
+				gtk_main_iteration ();
 			current_node = node;
 		} else
 			break;
@@ -507,7 +509,7 @@ gtk_dtree_construct (GtkDTree *dtree)
 	gtk_clist_columns_autosize (clist);
 	
 	gtk_ctree_set_line_style (ctree, GTK_CTREE_LINES_DOTTED);
-	gtk_ctree_set_reorderable (ctree, TRUE);
+	gtk_ctree_set_reorderable (ctree, FALSE);
 
 	gdk_dtree_load_pixmaps (dtree);
 	gtk_dtree_load_root_tree (dtree);

+ 15 - 5
gnome/gview.c

@@ -286,17 +286,27 @@ gnome_monitor (GtkWidget *widget, WView *view)
 }
 
 GnomeUIInfo gview_file_menu [] = {
-	GNOMEUIINFO_ITEM (N_("Goto line"),    N_("Jump to a specified line number"), &gnome_goto_line, NULL),
+	GNOMEUIINFO_ITEM_STOCK (N_("Goto line"),
+				N_("Jump to a specified line number"),
+				&gnome_goto_line, GNOME_STOCK_PIXMAP_JUMP_TO),
 	GNOMEUIINFO_ITEM (N_("Monitor file"), N_("Monitor file growing"),            &gnome_monitor, NULL),
-	GNOMEUIINFO_ITEM (N_("Quit"),         N_("Terminate the viewer"), &gview_quit, NULL),
+	GNOMEUIINFO_ITEM_STOCK (N_("Quit"),
+				N_("Terminate the viewer"),
+				&gview_quit, GNOME_STOCK_PIXMAP_QUIT),
 	{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
 };
 
 GnomeUIInfo gview_search_menu [] = {
-	GNOMEUIINFO_ITEM (N_("Search"),          N_("String search"),             gnome_normal_search_cmd, NULL),
-	GNOMEUIINFO_ITEM (N_("Regexp search"),   N_("Regular expression search"), gnome_regexp_search_cmd, NULL),
+	GNOMEUIINFO_ITEM_STOCK (N_("Search"),
+				N_("String search"),
+				gnome_normal_search_cmd, GNOME_STOCK_MENU_SEARCH),
+	GNOMEUIINFO_ITEM_STOCK (N_("Regexp search"),
+				N_("Regular expression search"),
+				gnome_regexp_search_cmd, GNOME_STOCK_MENU_SEARCH),
 	GNOMEUIINFO_SEPARATOR,			 
-	GNOMEUIINFO_ITEM (N_("Search again..."), N_("Continue searching"),        gnome_continue_search, NULL),
+	GNOMEUIINFO_ITEM_STOCK (N_("Search again..."),
+				N_("Continue searching"),
+				gnome_continue_search, GNOME_STOCK_MENU_SRCHRPL),
 	{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
 };