📄 support.c
字号:
/* support.c --- glade support code *//* Copyright (c) E. Lassauge, 2000-2001. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation. * * This file is provided AS IS with no warranties of any kind. The author * shall have no liability with respect to the infringement of copyrights, * trade secrets or any patents by this file or any part thereof. In no * event will the author be liable for any lost revenue or profits or * other special, indirect and consequential damages. * * mailto:lassauge@mail.dotcom.fr * http://lassauge.free.fr/ * * REVISION HISTORY: see Changelog * *//* * DO NOT EDIT THIS FILE - it is generated by Glade. */#ifdef HAVE_CONFIG_H# include <config.h>#endif#include <sys/stat.h>#include <unistd.h>#include <string.h>#include <gnome.h>#include "support.h"/* This is an internally used function to create pixmaps. */static GtkWidget *create_dummy_pixmap(GtkWidget * widget, gboolean gnome_pixmap);GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name){ GtkWidget *parent, *found_widget; for (;;) { if (GTK_IS_MENU(widget)) parent = gtk_menu_get_attach_widget(GTK_MENU(widget)); else parent = widget->parent; if (parent == NULL) break; widget = parent; } found_widget = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(widget), widget_name); if (!found_widget) g_warning(_("Widget not found: %s"), widget_name); return found_widget;}/* This is a dummy pixmap we use when a pixmap can't be found. */static char *dummy_pixmap_xpm[] = {/* columns rows colors chars-per-pixel */ "1 1 1 1", " c None",/* pixels */ " ", " "};/* This is an internally used function to create pixmaps. */static GtkWidget *create_dummy_pixmap(GtkWidget * widget, gboolean gnome_pixmap){ GdkColormap *colormap; GdkPixmap *gdkpixmap; GdkBitmap *mask; GtkWidget *pixmap; if (gnome_pixmap) { return gnome_pixmap_new_from_xpm_d(dummy_pixmap_xpm); } colormap = gtk_widget_get_colormap(widget); gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL, colormap, &mask, NULL, dummy_pixmap_xpm); if (gdkpixmap == NULL) g_error(_("Couldn't create replacement pixmap.")); pixmap = gtk_pixmap_new(gdkpixmap, mask); gdk_pixmap_unref(gdkpixmap); gdk_bitmap_unref(mask); return pixmap;}/* This is an internally used function to create pixmaps. */GtkWidget *create_pixmap(GtkWidget * widget, const gchar * filename, gboolean gnome_pixmap){ GtkWidget *pixmap; GdkColormap *colormap; GdkPixmap *gdkpixmap; GdkBitmap *mask; gchar *pathname; pathname = gnome_pixmap_file(filename); if (!pathname) { g_warning(_("Couldn't find pixmap file: %s"), filename); return create_dummy_pixmap(widget, gnome_pixmap); } if (gnome_pixmap) { pixmap = gnome_pixmap_new_from_file(pathname); g_free(pathname); return pixmap; } colormap = gtk_widget_get_colormap(widget); gdkpixmap = gdk_pixmap_colormap_create_from_xpm(NULL, colormap, &mask, NULL, pathname); if (gdkpixmap == NULL) { g_warning(_("Couldn't create pixmap from file: %s"), pathname); g_free(pathname); return create_dummy_pixmap(widget, gnome_pixmap); } g_free(pathname); pixmap = gtk_pixmap_new(gdkpixmap, mask); gdk_pixmap_unref(gdkpixmap); gdk_bitmap_unref(mask); return pixmap;}/* * This is an internally used fonction to support poor man's crypt for passwords */void crypt_password(gchar *destvar){ gint i; if(destvar) { /* simple non secure password munging */ for (i = 0; destvar[i] != '\0'; i++) destvar[i] ^= 0x42; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -