示例#1
0
文件: support.c 项目: erikg/GEMS
/*
 * This is an internally used function to create imlib images. 
 */
GdkImlibImage *
create_image (const gchar * filename)
{
    GdkImlibImage *image;
    gchar *pathname;

    pathname = gnome_pixmap_file (filename);
    if (!pathname)
    {
	g_warning (_("Couldn't find pixmap file: %s"), filename);
	return NULL;
    }
    image = gdk_imlib_load_image (pathname);
    g_free (pathname);
    return image;
}
示例#2
0
文件: support.c 项目: erikg/GEMS
/*
 * 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;

    if (!filename || !filename[0])
	return create_dummy_pixmap (widget, gnome_pixmap);

    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;
}
示例#3
0
文件: at_new.c 项目: piki/gat
at_job_t *make_new_at_job() {
  GtkWidget *druid, *page_start, *page_at1, *page_at2, *page_finish;
  GtkWidget *hbox, *frame, *align, *bigvbox;
  at_druid_info *info;
  struct tm *tp;
  time_t t;
  char *fname;
  GdkPixbuf *logo = NULL;

  fname = gnome_pixmap_file("gnome-clock.png");
  if (fname)
    logo = gdk_pixbuf_new_from_file(fname, NULL);
  g_free(fname);

  time(&t);
  tp = localtime(&t);

  info = g_new(at_druid_info, 1);
  druid = gnome_druid_new_with_window("New One-Time Job",
    NULL, TRUE, &info->win);

  page_start = gnome_druid_page_edge_new_with_vals(
    GNOME_EDGE_START, FALSE,
    "Create new one-time job",
    "This series of dialogs will step\n"
    "you through the process of creating\n"
    "a new one-time job.", logo, NULL, NULL);
  page_at1 = gnome_druid_page_standard_new_with_vals(
    "Choose a time and date", logo, NULL);
  page_at2 = gnome_druid_page_standard_new_with_vals(
    "Select command", logo, NULL);
  page_finish = gnome_druid_page_edge_new_with_vals(
    GNOME_EDGE_FINISH, FALSE,
    "Confirm new job", NULL, logo, NULL, NULL);

  bigvbox = gtk_vbox_new(FALSE, 0);
  align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
  gtk_container_add(GTK_CONTAINER(align), bigvbox);
  gtk_box_pack_start(GTK_BOX(GNOME_DRUID_PAGE_STANDARD(page_at1)->vbox),
    align, TRUE, TRUE, 0);

  info->cal = gtk_calendar_new();
  gtk_box_pack_start(GTK_BOX(bigvbox), info->cal, FALSE, FALSE, 0);

  hbox = gtk_hbox_new(FALSE, 0);
  frame = gtk_frame_new("Time");
  gtk_container_set_border_width(GTK_CONTAINER(frame), 8);
  gtk_box_pack_start(GTK_BOX(bigvbox), frame, FALSE, FALSE, 0);
  gtk_container_add(GTK_CONTAINER(frame), hbox);

  info->hour = make_new_spinner("Hour:", tp->tm_hour, 0, 23, 5, hbox);
  info->minute = make_new_spinner("Minute:", tp->tm_min, 0, 59, 5, hbox);

  info->command = make_job_page(GNOME_DRUID_PAGE_STANDARD(page_at2)->vbox);

  gtk_signal_connect_object(GTK_OBJECT(page_finish), "finish",
    GTK_SIGNAL_FUNC(at_commit_job), (gpointer)info);
  gtk_signal_connect_object(GTK_OBJECT(info->win), "destroy",
    GTK_SIGNAL_FUNC(g_free), (gpointer)info);
  gtk_signal_connect(GTK_OBJECT(page_finish), "prepare",
    GTK_SIGNAL_FUNC(prepare_last_page), (gpointer)info);
  gtk_signal_connect(GTK_OBJECT(info->command), "changed",
    GTK_SIGNAL_FUNC(cmd_changed), (gpointer)druid);

  gnome_druid_append_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_start));
  gnome_druid_append_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_at1));
  gnome_druid_append_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_at2));
  gnome_druid_append_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_finish));
  gnome_druid_set_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_start));
  gtk_window_set_modal(GTK_WINDOW(info->win), TRUE);
  gtk_widget_show_all(info->win);

  g_object_unref(logo);

  return NULL;
}