Commit 4838d5fa authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

warning fixes

1999-12-16  Havoc Pennington  <hp@redhat.com>

* src/file-manager/gnome-desktop.c (main): warning fixes

* src/file-manager/desktop-canvas.c
(desktop_canvas_update_background): start actually honoring
background settings.

* src/file-manager/fm-icon-cache.c: add copyright and Emacs magic.

* src/file-manager/fm-icon-cache.h (fm_icon_cache_get_icon): Run
egtk-format-protos on these prototypes, add copyright and Emacs magic
parent e0138e85
1999-12-16 Havoc Pennington <hp@redhat.com>
* src/file-manager/gnome-desktop.c (main): warning fixes
* src/file-manager/desktop-canvas.c
(desktop_canvas_update_background): start actually honoring
background settings.
* src/file-manager/fm-icon-cache.c: add copyright and Emacs magic.
* src/file-manager/fm-icon-cache.h (fm_icon_cache_get_icon): Run
egtk-format-protos on these prototypes, add copyright and Emacs magic
1999-12-16 Havoc Pennington <hp@redhat.com>
* src/file-manager/desktop-canvas.h: Added API for controlling the
......
......@@ -195,6 +195,7 @@ desktop_canvas_init (DesktopCanvas *dcanvas)
gboolean use_stipple = FALSE;
dcanvas->background_info = desktop_background_info_new();
dcanvas->background_update_idle = 0;
stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
......@@ -298,8 +299,11 @@ desktop_canvas_destroy (GtkObject *object)
canvas = DESKTOP_CANVAS(object);
/* does nothing for now */
if (canvas->background_update_idle != 0) {
gtk_idle_remove(canvas->background_update_idle);
canvas->background_update_idle = 0;
}
(* GTK_OBJECT_CLASS(parent_class)->destroy) (object);
}
......@@ -365,6 +369,72 @@ desktop_canvas_size_allocate(GtkWidget *widget,
* Background accessor functions
*/
static void
rgb32_to_gdkcolor(guint32 rgb, GdkColor* color)
{
guchar r, g, b;
r = (rgb >> 16) & 0xFF;
g = (rgb >> 8) & 0xFF;
b = rgb & 0xFF;
color->red = r*255;
color->green = g*255;
color->blue = b*255;
}
static void
set_widget_color(GtkWidget* w, guint32 rgb)
{
GtkStyle* style;
gtk_widget_ensure_style(w);
style = gtk_style_copy(w->style);
rgb32_to_gdkcolor(rgb, &style->bg[GTK_STATE_NORMAL]);
/* FIXME should use modify_style */
gtk_widget_set_style(w, style);
gtk_style_unref(style);
}
static gint
update_bg_idle(gpointer data)
{
DesktopCanvas *canvas;
canvas = data;
g_return_val_if_fail(canvas != NULL, FALSE);
g_return_val_if_fail(DESKTOP_IS_CANVAS(canvas), FALSE);
switch (canvas->background_info->background_type) {
case DesktopBackgroundSolid:
set_widget_color(GTK_WIDGET(canvas), canvas->background_info->solid_color);
break;
default:
g_warning("FIXME not implemented yet");
break;
}
canvas->background_update_idle = 0;
return FALSE; /* remove idle */
}
/* This function is expensive. All the "setters" check that a change has
actually been made before they call it. */
static void
desktop_canvas_update_background (DesktopCanvas *canvas)
{
g_return_if_fail(canvas != NULL);
g_return_if_fail(DESKTOP_IS_CANVAS(canvas));
if (canvas->background_update_idle == 0)
canvas->background_update_idle = gtk_idle_add(update_bg_idle, canvas);
}
void
desktop_canvas_set_background_type (DesktopCanvas *canvas,
DesktopBackgroundType type)
......@@ -376,6 +446,8 @@ desktop_canvas_set_background_type (DesktopCanvas *canvas,
return;
canvas->background_info->background_type = type;
desktop_canvas_update_background (canvas);
}
DesktopBackgroundType
......@@ -407,6 +479,8 @@ desktop_canvas_set_image_background_type (DesktopCanvas *canvas,
return;
canvas->background_info->image_type = type;
desktop_canvas_update_background (canvas);
}
void
......@@ -429,6 +503,8 @@ desktop_canvas_set_image_background_file (DesktopCanvas *canvas,
g_free(canvas->background_info->image_filename);
canvas->background_info->image_filename = filename ? g_strdup(filename) : NULL;
desktop_canvas_update_background (canvas);
}
......@@ -465,6 +541,8 @@ desktop_canvas_set_solid_background_color (DesktopCanvas *canvas,
return;
canvas->background_info->solid_color = rgb;
desktop_canvas_update_background (canvas);
}
DesktopGradientType
......@@ -487,6 +565,8 @@ desktop_canvas_set_gradient_background_type (DesktopCanvas *canvas,
return;
canvas->background_info->gradient_type = type;
desktop_canvas_update_background (canvas);
}
guint32
......@@ -509,6 +589,8 @@ desktop_canvas_set_northwest_gradient_color (DesktopCanvas *canvas,
return;
canvas->background_info->northwest_gradient_color = rgb;
desktop_canvas_update_background (canvas);
}
......@@ -532,6 +614,8 @@ desktop_canvas_set_southeast_gradient_color (DesktopCanvas *canvas,
return;
canvas->background_info->southeast_gradient_color = rgb;
desktop_canvas_update_background (canvas);
}
......
......@@ -84,7 +84,8 @@ typedef struct _DesktopCanvasClass DesktopCanvasClass;
struct _DesktopCanvas {
GnomeCanvas canvas;
DesktopBackgroundInfo *background_info;
DesktopBackgroundInfo *background_info;
guint background_update_idle;
};
struct _DesktopCanvasClass {
......
/* -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*-
* GNOME File Manager: Icon Cache
*
* Copyright (C) 1999 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#include "fm-icon-cache.h"
#include <gnome.h>
......
/* -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*-
* GNOME File Manager: Icon Cache
*
* Copyright (C) 1999 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#ifndef FM_ICON_CACHE_H
#define FM_ICON_CACHE_H 1
......@@ -7,10 +27,15 @@
typedef struct _FMIconCache FMIconCache;
FMIconCache *fm_icon_cache_new(const char *theme_name);
void fm_icon_cache_destroy(FMIconCache *fmic);
FMIconCache *fm_icon_cache_new (const char *theme_name);
void fm_icon_cache_destroy (FMIconCache *fmic);
void fm_icon_cache_set_theme (FMIconCache *fmic,
const char *theme_name);
/* Ownership of a refcount in this pixbuf comes with the deal */
GdkPixbuf * fm_icon_cache_get_icon (FMIconCache *fmic,
const GnomeVFSFileInfo *info);
void fm_icon_cache_set_theme(FMIconCache *fmic, const char *theme_name);
GdkPixbuf *fm_icon_cache_get_icon(FMIconCache *fmic, const GnomeVFSFileInfo *info); /* Ownership of a refcount in
this pixbuf comes with the deal */
#endif
......@@ -31,7 +31,7 @@
#include "desktop-window.h"
#include "desktop-canvas.h"
gint
static gint
delete_event_cb(GtkWidget* window, GdkEventAny* event, gpointer data)
{
gtk_main_quit();
......@@ -42,10 +42,11 @@ main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *canvas;
#if 0
bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
textdomain (PACKAGE);
#endif
gnome_init ("gnome-desktop", VERSION, argc, argv);
window = desktop_window_new();
......
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