Example #1
0
static GtkWidget *
_toolbar_new (OlScrollModule *module)
{
  GtkWidget *toolbar = gtk_hbox_new (FALSE, 0);
  OlImageButton *button = OL_IMAGE_BUTTON (ol_image_button_new ());
  GtkIconTheme *icontheme = gtk_icon_theme_get_default ();
  GtkIconInfo *info = gtk_icon_theme_lookup_icon (icontheme,
                                                  OL_STOCK_SCROLL_CLOSE,
                                                  16,
                                                  0);
  
  GdkPixbuf *image = gdk_pixbuf_new_from_file (gtk_icon_info_get_filename (info),
                                               NULL);
  ol_image_button_set_pixbuf (button, image);
  g_signal_connect (button, "clicked", G_CALLBACK (_close_clicked_cb), module);
  gtk_container_add (GTK_CONTAINER (toolbar),
                     GTK_WIDGET (button));
  gtk_icon_info_free (info);

  gtk_widget_show_all (toolbar);
  return toolbar;
}
Example #2
0
static GtkButton *
_add_button (OlOsdToolbar *toolbar,
             const struct ButtonSpec *btn_spec)
{
  OlImageButton *btn = OL_IMAGE_BUTTON (ol_image_button_new ());
  GtkIconTheme *icontheme = gtk_icon_theme_get_default ();
  GtkIconInfo *info = gtk_icon_theme_lookup_icon (icontheme,
                                                  btn_spec->stock,
                                                  16,
                                                  0);
  
  GdkPixbuf *image = gdk_pixbuf_new_from_file (gtk_icon_info_get_filename (info),
                                               NULL);
  gtk_icon_info_free (info);
  ol_image_button_set_pixbuf (btn, image);
  g_signal_connect (btn,
                    "clicked",
                    G_CALLBACK (btn_spec->handler),
                    toolbar);
  gtk_box_pack_start (GTK_BOX (toolbar->center_box), GTK_WIDGET (btn),
                      FALSE, TRUE, 0);
  gtk_widget_show (GTK_WIDGET (btn));
  return GTK_BUTTON (btn);
}