diff options
-rw-r--r-- | ChangeLog | 57 | ||||
-rw-r--r-- | components/hardware/nautilus-hardware-view.c | 12 | ||||
-rw-r--r-- | components/help/converters/gnome-db2html2/sect-elements.c | 8 | ||||
-rw-r--r-- | components/services/vault/command-line/vault-operations.c | 1 | ||||
-rw-r--r-- | cut-n-paste-code/freetype/ftcalc.h | 12 | ||||
-rw-r--r-- | cut-n-paste-code/freetype/ftconfig.h | 2 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-file-utilities.c | 4 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-list.c | 1 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-utilities.c | 4 | ||||
-rw-r--r-- | libnautilus-private/nautilus-list.c | 1 | ||||
-rw-r--r-- | librsvg/art_render_mask.c | 1 | ||||
-rw-r--r-- | librsvg/rsvg-bpath-util.c | 1 | ||||
-rw-r--r-- | librsvg/rsvg-ft.c | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/nautilus-complex-search-bar.c | 23 | ||||
-rw-r--r-- | src/nautilus-window-toolbars.c | 99 |
16 files changed, 167 insertions, 61 deletions
@@ -1,3 +1,60 @@ +Fri Aug 04 14:21:51 2000 George Lebl <jirka@5z.com> + + * components/hardware/nautilus-hardware-view.c (setup_form_title): + Check result of gnome_pixmap_file. If NULL, we can't make a new + gnome-pixmap. + + * components/help/converters/gnome-db2html2/sect-elements.c + (sect_get_infobox_logo) (sect_infobox_start_element): + sect_get_infobox_logo can return a NULL so check its return + and if NULL just add %s instead of <IMG ...> + + * components/services/vault/command-line/vault-operations.c, + libnautilus-extensions/nautilus-list.c: + add #include <string.h> + + * cut-n-paste-code/freetype/ftcalc.h, + cut-n-paste-code/freetype/ftconfig.h: Well even though this + is cut and paste code I NEED to add this patch for it to even + compile on alpha, I'll try to get this upstream. The only changes + are inside #ifdefs on platforms where long is 64 bit so it should + not affect intel code at all. + + * libnautilus-extensions/nautilus-file-utilities.c + (nautilus_format_uri_for_display): use g_strdup instead of strdup + as then g_free is used and this would really confuse glib in memory + checking mode. + + + * librsvg/art_render_mask.c, librsvg/rsvg-bpath-util.c, + librsvg/rsvg-ft.c: add #include <string.h> + + * src/Makefile.am: define NAUTILUS_PIXMAPDIR. This is neccessary for + both making the tarballs and actual code sanity on switching + toolbar themes etc. In GNOME 2.0 the GNOME_PATH can be sanely used + to allow relocatable nautilus binary, but in 1.[02] this is the + correct way to do things. + + * src/nautilus-complex-search-bar.c + (nautilus_complex_search_bar_initialize) + (load_find_them_pixmap_widget): If we can't load pixmaps don't + add them. Also don't hardcode "/gnome/share" prefix and use + the NAUTILUS_PIXMAPDIR define to find search.png AND make sure + we can load it before using it. + + * src/nautilus-window-toolbars.c (find_toolbar_child) (setup_button) + In toolbar_info use the NAUTILUS_PIXMAPDIR define to find pixmaps. + remove get_stock_callback and get_stock_widget as those functions + were an incredible hack and were likely to break. Replace with a + function which searches the toolbar children and then finds correct + icon widget. It also doesn't do anything if there is no icon. In + setup button, use NAUTILUS_PIXMAPDIR to define pixmaps by their + full name. If we cannot set the stock widget icon, then the icon + is not registered and we register it with gnome-stock. + Miraculously the current code worked but only worked because the + eazel theme was set up in the toolbar_info, other themes with + outside images would break. + 2000-08-04 Arlo Rose <arlo@eazel.com> * icons/arlo/Makefile.am: diff --git a/components/hardware/nautilus-hardware-view.c b/components/hardware/nautilus-hardware-view.c index 4875b6137..66f19bcfc 100644 --- a/components/hardware/nautilus-hardware-view.c +++ b/components/hardware/nautilus-hardware-view.c @@ -282,12 +282,14 @@ setup_form_title (NautilusHardwareView *view, const char* image_name, const char gtk_box_pack_start (GTK_BOX(view->details->form), temp_container, 0, 0, 4); gtk_widget_show(temp_container); - if (image_name) { + if (image_name != NULL) { file_name = gnome_pixmap_file (image_name); - temp_widget = GTK_WIDGET (gnome_pixmap_new_from_file (file_name)); - gtk_box_pack_start(GTK_BOX(temp_container), temp_widget, 0, 0, 8); - gtk_widget_show(temp_widget); - g_free (file_name); + if (file_name != NULL) { + temp_widget = GTK_WIDGET (gnome_pixmap_new_from_file (file_name)); + gtk_box_pack_start(GTK_BOX(temp_container), temp_widget, 0, 0, 8); + gtk_widget_show(temp_widget); + g_free (file_name); + } } temp_widget = gtk_label_new (title_text); diff --git a/components/help/converters/gnome-db2html2/sect-elements.c b/components/help/converters/gnome-db2html2/sect-elements.c index ba34299ea..4c7c6e483 100644 --- a/components/help/converters/gnome-db2html2/sect-elements.c +++ b/components/help/converters/gnome-db2html2/sect-elements.c @@ -1108,6 +1108,7 @@ sect_programlisting_end_element (Context *context, sect_print (context, "</pre>\n</td></tr>\n</table>\n"); } +/* Note that this can return NULL if the file is not found */ static gchar * sect_get_infobox_logo (const gchar *name) { @@ -1134,7 +1135,12 @@ sect_infobox_start_element (Context *context, logo = sect_get_infobox_logo (name); - sect_print (context, "<TABLE BORDER=\"0\" WIDTH=\"100%%\">\n<tr><TD WIDTH=\"25%%\" ALIGN=\"CENTER\" VALIGN=\"TOP\"><IMG ALT=\"%s\" SRC=\"%s\"><TH ALIGN=\"LEFT\" VALIGN=\"CENTER\"></TD>\n", name, logo); + sect_print (context, "<TABLE BORDER=\"0\" WIDTH=\"100%%\">\n<tr><TD WIDTH=\"25%%\" ALIGN=\"CENTER\" VALIGN=\"TOP\">"); + if (logo != NULL) + sect_print (context, "<IMG ALT=\"%s\" SRC=\"%s\">", name, logo); + else + sect_print (context, "%s", name); + sect_print (context, "<TH ALIGN=\"LEFT\" VALIGN=\"CENTER\"></TD>\n"); sect_print (context, "<TD> </TD>\n<TD ALIGN=\"LEFT\" VALIGN=\"TOP\">\n"); g_free (logo); } diff --git a/components/services/vault/command-line/vault-operations.c b/components/services/vault/command-line/vault-operations.c index 4256726a2..15a70610b 100644 --- a/components/services/vault/command-line/vault-operations.c +++ b/components/services/vault/command-line/vault-operations.c @@ -22,6 +22,7 @@ */ #include <config.h> +#include <string.h> #include <unistd.h> #include <glib.h> #include <string.h> diff --git a/cut-n-paste-code/freetype/ftcalc.h b/cut-n-paste-code/freetype/ftcalc.h index 8acc68dc1..60e439e8c 100644 --- a/cut-n-paste-code/freetype/ftcalc.h +++ b/cut-n-paste-code/freetype/ftcalc.h @@ -22,12 +22,12 @@ #ifdef FT_FLAT_COMPILE #include "freetype.h" -#include "ftconfig.h" /* for LONG64 */ +#include "ftconfig.h" /* for FT_LONG64 */ #else #include <freetype/freetype.h> -#include <freetype/config/ftconfig.h> /* for LONG64 */ +#include <freetype/config/ftconfig.h> /* for FT_LONG64 */ #endif @@ -36,10 +36,10 @@ #endif -#ifdef LONG64 +#ifdef FT_LONG64 - typedef INT64 FT_Int64; + typedef FT_INT64 FT_Int64; #define ADD_64( x, y, z ) z = (x) + (y) #define MUL_64( x, y, z ) z = (FT_Int64)(x) * (y) @@ -54,7 +54,7 @@ #endif /* FT_CONFIG_OPTION_OLD_CALCS */ -#else /* LONG64 */ +#else /* FT_LONG64 */ typedef struct FT_Int64_ @@ -87,7 +87,7 @@ #endif /* OLD_CALC */ -#endif /* LONG64 */ +#endif /* FT_LONG64 */ #ifndef FT_CONFIG_OPTION_OLD_CALCS diff --git a/cut-n-paste-code/freetype/ftconfig.h b/cut-n-paste-code/freetype/ftconfig.h index 140d17391..f95727685 100644 --- a/cut-n-paste-code/freetype/ftconfig.h +++ b/cut-n-paste-code/freetype/ftconfig.h @@ -170,8 +170,10 @@ /* */ #ifdef FTCALC_USE_LONG_LONG +#ifndef FT_LONG64 #define FT_LONG64 #define FT_INT64 long long +#endif #endif /* FTCALC_USE_LONG_LONG */ #endif diff --git a/libnautilus-extensions/nautilus-file-utilities.c b/libnautilus-extensions/nautilus-file-utilities.c index 6ddc4aefc..04f25df99 100644 --- a/libnautilus-extensions/nautilus-file-utilities.c +++ b/libnautilus-extensions/nautilus-file-utilities.c @@ -86,9 +86,9 @@ nautilus_format_uri_for_display (const char *uri) /* Remove file:// from the beginning */ if (nautilus_istr_has_prefix (uri, DEFAULT_SCHEME)) { - toreturn = strdup (unescaped + sizeof (DEFAULT_SCHEME) - 1); + toreturn = g_strdup (unescaped + sizeof (DEFAULT_SCHEME) - 1); } else { - toreturn = strdup (unescaped); + toreturn = g_strdup (unescaped); } g_free (unescaped); diff --git a/libnautilus-extensions/nautilus-list.c b/libnautilus-extensions/nautilus-list.c index f59fa7fb0..3a8970e68 100644 --- a/libnautilus-extensions/nautilus-list.c +++ b/libnautilus-extensions/nautilus-list.c @@ -30,6 +30,7 @@ #include "nautilus-list.h" #include <ctype.h> +#include <string.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtkbindings.h> #include <gtk/gtkdnd.h> diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c index 6ddc4aefc..04f25df99 100644 --- a/libnautilus-private/nautilus-file-utilities.c +++ b/libnautilus-private/nautilus-file-utilities.c @@ -86,9 +86,9 @@ nautilus_format_uri_for_display (const char *uri) /* Remove file:// from the beginning */ if (nautilus_istr_has_prefix (uri, DEFAULT_SCHEME)) { - toreturn = strdup (unescaped + sizeof (DEFAULT_SCHEME) - 1); + toreturn = g_strdup (unescaped + sizeof (DEFAULT_SCHEME) - 1); } else { - toreturn = strdup (unescaped); + toreturn = g_strdup (unescaped); } g_free (unescaped); diff --git a/libnautilus-private/nautilus-list.c b/libnautilus-private/nautilus-list.c index f59fa7fb0..3a8970e68 100644 --- a/libnautilus-private/nautilus-list.c +++ b/libnautilus-private/nautilus-list.c @@ -30,6 +30,7 @@ #include "nautilus-list.h" #include <ctype.h> +#include <string.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtkbindings.h> #include <gtk/gtkdnd.h> diff --git a/librsvg/art_render_mask.c b/librsvg/art_render_mask.c index 592cdf333..def056a04 100644 --- a/librsvg/art_render_mask.c +++ b/librsvg/art_render_mask.c @@ -22,6 +22,7 @@ * Authors: Raph Levien <raph@acm.org> */ +#include <string.h> #include <libart_lgpl/art_misc.h> #include <libart_lgpl/art_alphagamma.h> diff --git a/librsvg/rsvg-bpath-util.c b/librsvg/rsvg-bpath-util.c index 1c8cca5bb..185959f5b 100644 --- a/librsvg/rsvg-bpath-util.c +++ b/librsvg/rsvg-bpath-util.c @@ -23,6 +23,7 @@ #include <glib.h> #include <math.h> +#include <string.h> #include "rsvg-bpath-util.h" /* This is adapted from gnome-canvas-bpath-util in libgnomeprint diff --git a/librsvg/rsvg-ft.c b/librsvg/rsvg-ft.c index 193ba830a..68346e9d3 100644 --- a/librsvg/rsvg-ft.c +++ b/librsvg/rsvg-ft.c @@ -24,6 +24,7 @@ #include <glib.h> #include <stdio.h> +#include <string.h> #include <stdlib.h> #include <math.h> diff --git a/src/Makefile.am b/src/Makefile.am index e936d1bea..3b13b45e2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,6 +19,7 @@ INCLUDES =\ -DVERSION="\"$(VERSION)\"" \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DNAUTILUS_DATADIR=\""$(datadir)/nautilus"\" \ + -DNAUTILUS_PIXMAPDIR=\""$(datadir)/pixmaps/nautilus"\" \ $(NULL) LDADD =\ diff --git a/src/nautilus-complex-search-bar.c b/src/nautilus-complex-search-bar.c index 255696da6..18b677f68 100644 --- a/src/nautilus-complex-search-bar.c +++ b/src/nautilus-complex-search-bar.c @@ -156,11 +156,12 @@ nautilus_complex_search_bar_initialize (NautilusComplexSearchBar *bar) bar->details->find_them = gtk_button_new (); find_them_box = gtk_hbox_new (FALSE, 1); find_them_pixmap_widget = load_find_them_pixmap_widget (); - gtk_box_pack_start (GTK_BOX (find_them_box), - find_them_pixmap_widget, - TRUE, - FALSE, - 1); + if (find_them_pixmap_widget != NULL) + gtk_box_pack_start (GTK_BOX (find_them_box), + find_them_pixmap_widget, + TRUE, + FALSE, + 1); find_them_label = gtk_label_new ("Find Them!"); gtk_box_pack_start (GTK_BOX (find_them_box), find_them_label, @@ -315,11 +316,13 @@ load_find_them_pixmap_widget (void) GdkPixmap *pixmap; GdkBitmap *mask; - pixbuf = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus/search.png"); - gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, 128); - gdk_pixbuf_unref (pixbuf); - - return gtk_pixmap_new (pixmap, mask); + pixbuf = gdk_pixbuf_new_from_file (NAUTILUS_PIXMAPDIR "/search.png"); + if(pixmap != NULL) { + gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, 128); + gdk_pixbuf_unref (pixbuf); + return gtk_pixmap_new (pixmap, mask); + } else + return NULL; } diff --git a/src/nautilus-window-toolbars.c b/src/nautilus-window-toolbars.c index 8a53a1a2e..79889ae18 100644 --- a/src/nautilus-window-toolbars.c +++ b/src/nautilus-window-toolbars.c @@ -115,43 +115,52 @@ toolbar_search_web_callback (GtkWidget *widget, NautilusWindow *window) static GnomeUIInfo toolbar_info[] = { GNOMEUIINFO_ITEM_STOCK (N_("Back"), N_("Go to the previously visited directory"), - toolbar_back_callback, "nautilus/eazel/Back.png"), + toolbar_back_callback, + NAUTILUS_PIXMAPDIR "/eazel/Back.png"), GNOMEUIINFO_ITEM_STOCK (N_("Forward"), N_("Go to the next directory"), - toolbar_forward_callback, "nautilus/eazel/Forward.png"), + toolbar_forward_callback, + NAUTILUS_PIXMAPDIR "/eazel/Forward.png"), GNOMEUIINFO_ITEM_STOCK (N_("Up"), N_("Go up a level in the directory hierarchy"), - toolbar_up_callback, "nautilus/eazel/Up.png"), + toolbar_up_callback, + NAUTILUS_PIXMAPDIR "/eazel/Up.png"), GNOMEUIINFO_ITEM_STOCK (N_("Reload"), N_("Reload this view"), - toolbar_reload_callback, "nautilus/eazel/Refresh.png"), + toolbar_reload_callback, + NAUTILUS_PIXMAPDIR "/eazel/Refresh.png"), GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_STOCK (N_("Home"), N_("Go to your home directory"), - toolbar_home_callback, "nautilus/eazel/Home.png"), + toolbar_home_callback, + NAUTILUS_PIXMAPDIR "/eazel/Home.png"), NAUTILUS_GNOMEUIINFO_TOGGLEITEM_STOCK (N_("Search"), N_("Search this computer for files"), - toolbar_search_local_callback, "nautilus/eazel/Search.png"), + toolbar_search_local_callback, + NAUTILUS_PIXMAPDIR "/eazel/Search.png"), GNOMEUIINFO_ITEM_STOCK (N_("Web Search"), N_("Search the web"), - toolbar_search_web_callback, "nautilus/eazel/Search.png"), + toolbar_search_web_callback, + NAUTILUS_PIXMAPDIR "/eazel/Search.png"), GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_STOCK (N_("Stop"), N_("Interrupt loading"), - toolbar_stop_callback, "nautilus/eazel/Stop.png"), + toolbar_stop_callback, + NAUTILUS_PIXMAPDIR "/eazel/Stop.png"), #if defined(EAZEL_SERVICES) GNOMEUIINFO_ITEM_STOCK (N_("Services"), N_("Eazel Services"), - toolbar_services_callback, "nautilus/eazel/Services.png"), + toolbar_services_callback, + NAUTILUS_PIXMAPDIR "/eazel/Services.png"), #endif GNOMEUIINFO_END }; @@ -257,47 +266,67 @@ remember_buttons(NautilusWindow *window, GnomeUIInfo current_toolbar_info[]) window->home_button = current_toolbar_info[TOOLBAR_HOME_BUTTON_INDEX].widget; } -/* utility to find the stock widget within a toolbar button so we can switch it's pixmap */ - -static void -get_stock_callback (GtkWidget *widget, gpointer callback_data) +/* find the toolbar child structure within a toolbar. This way we can easily + * find the icon in a clean way */ +static GtkToolbarChild * +find_toolbar_child(GtkToolbar *toolbar, GtkWidget *button) { - GtkWidget **stock_widget; - stock_widget = callback_data; - - if (GNOME_IS_STOCK_PIXMAP_WIDGET(widget)) { - *stock_widget = widget; - /* We'd stop the iterating now if we could. */ + GList *li; + for (li = toolbar->children; li != NULL; li = li->next) { + GtkToolbarChild *child = li->data; + if (child->widget == button) + return child; } + return NULL; } -static GtkWidget * -get_stock_widget (GtkContainer *container) -{ - GtkWidget *stock_widget; - - stock_widget = NULL; - gtk_container_foreach (container, get_stock_callback, &stock_widget); - return stock_widget; -} - - /* set up the toolbar info based on the current theme selection from preferences */ static void setup_button(GtkWidget* button, const char *theme_name, const char *icon_name) { - GtkWidget *widget; + GnomeStock *stock_widget; char *full_name; - + GtkToolbarChild *toolbar_child; + if ((theme_name == NULL) || (strcmp(theme_name, "default") == 0)) { full_name = g_strdup (icon_name); } else { - full_name = g_strdup_printf ("nautilus/%s/%s.png", theme_name, icon_name); + full_name = g_strdup_printf (NAUTILUS_PIXMAPDIR "/%s/%s.png", theme_name, icon_name); } - widget = get_stock_widget (GTK_CONTAINER (GTK_BIN (button)->child)); - gnome_stock_set_icon (GNOME_STOCK (widget), full_name); + toolbar_child = find_toolbar_child (GTK_TOOLBAR (button->parent), button); + if (toolbar_child != NULL && + toolbar_child->icon != NULL && + GNOME_IS_STOCK (toolbar_child->icon)) + stock_widget = GNOME_STOCK (toolbar_child->icon); + else + stock_widget = NULL; + + if (stock_widget != NULL && + ! gnome_stock_set_icon (stock_widget, full_name) && + g_file_exists(full_name)) { + /* if full_name exists but gnome_stock_set_icon fails, that means + * this file has NOT been registered with gnome stock. Unfortunately + * gnome_stock is a worthless pile of dung and doesn't do this for us. + * Do note however that it DOES register this stuff when it first + * creates the toolbars from GnomeUIInfo. */ + GnomeStockPixmapEntryPath *new_entry; + new_entry = g_malloc(sizeof(GnomeStockPixmapEntryPath)); + new_entry->type = GNOME_STOCK_PIXMAP_TYPE_PATH; + new_entry->label = NULL; + new_entry->pathname = full_name; + new_entry->width = 0; + new_entry->height = 0; + /* register this under the "full_name" as that's what we'll look it + * up under later */ + gnome_stock_pixmap_register(full_name, GNOME_STOCK_PIXMAP_REGULAR, + (GnomeStockPixmapEntry *)new_entry); + full_name = NULL; /* we used it in new_entry, so we just transfer + ownership */ + gnome_stock_set_icon (stock_widget, full_name); + } + g_free (full_name); gtk_widget_queue_resize (button); } |