static void
gtk_source_mark_attributes_set_property (GObject      *object,
					 guint         prop_id,
					 const GValue *value,
					 GParamSpec   *pspec)
{
	GtkSourceMarkAttributes *self = GTK_SOURCE_MARK_ATTRIBUTES (object);

	switch (prop_id)
	{
		case PROP_BACKGROUND:
			set_background (self, g_value_get_boxed (value));
			break;
		case PROP_STOCK_ID:
			set_stock_id (self, g_value_get_string (value));
			break;
		case PROP_PIXBUF:
			set_pixbuf (self, g_value_get_object (value));
			break;
		case PROP_ICON_NAME:
			set_icon_name (self, g_value_get_string (value));
			break;
		case PROP_GICON:
			set_gicon (self, g_value_get_object (value));
			break;
		default:
			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
			break;
	}
}
/**
 * gtk_source_mark_attributes_set_pixbuf:
 * @attributes: a #GtkSourceMarkAttributes.
 * @pixbuf: a #GdkPixbuf to be used.
 *
 * Sets a pixbuf to be used as a base for rendered icon.
 */
void
gtk_source_mark_attributes_set_pixbuf (GtkSourceMarkAttributes *attributes,
				       const GdkPixbuf         *pixbuf)
{
	g_return_if_fail (GTK_SOURCE_IS_MARK_ATTRIBUTES (attributes));

	set_pixbuf (attributes, pixbuf);
}
示例#3
0
WG_PRIVATE void
update_image_cb(void *data)
{
    Update_image *work = NULL;

    work = (Update_image*)data;

    set_pixbuf(work->display, work->x, work->y, work->pixbuf); 

    g_object_unref(work->pixbuf);

    return;
}
示例#4
0
void AddToIcon::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window,
                                 Gtk::Widget& widget,
                                 const Gdk::Rectangle& background_area,
                                 const Gdk::Rectangle& cell_area,
                                 const Gdk::Rectangle& expose_area,
                                 Gtk::CellRendererState flags )
#endif
{
    set_pixbuf();
    
#if WITH_GTKMM_3_0
    Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags );
#else
    Gtk::CellRendererPixbuf::render_vfunc( window, widget, background_area, cell_area, expose_area, flags );
#endif
}
示例#5
0
void user_install_dialog_create(UserInstallCallback callback)
{
  GtkWidget *dialog;
  GtkWidget *vbox;
  GtkWidget *hbox;
  GtkWidget *ebox;
  GtkWidget *table;
  GtkWidget *darea;
  GtkWidget *page;
  GtkWidget *sep;
  PangoFontDescription *large_font_desc;
  gchar* Version_S = g_strdup_printf("%d.%d.%d",MAJOR_VERSION,MINOR_VERSION,MICRO_VERSION);
  gchar* temp = NULL;

  dialog = user_install_dialog = gtk_dialog_new ();
  gtk_window_set_position(GTK_WINDOW(dialog),GTK_WIN_POS_CENTER);
  gtk_window_set_title(&GTK_DIALOG(dialog)->window,_("Gabedit User Installation"));

  gtk_widget_realize (dialog);
  set_icone(GTK_WIDGET(dialog));

  action_area = gtk_hbox_new(FALSE, 8);
  gtk_box_set_homogeneous(GTK_BOX(action_area), FALSE);
  gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), action_area);

  /*  B/W Style for the page contents  */
  page_style = gtk_style_copy(gtk_widget_get_default_style());
  colormap = gtk_widget_get_colormap(dialog);

  black_color.red = 0;
  black_color.green = 0;
  black_color.blue = 0;
  gdk_colormap_alloc_color (colormap, &black_color, FALSE, TRUE);

  white_color.red = 65535;
  white_color.green = 65535;
  white_color.blue = 65535;
  gdk_colormap_alloc_color (colormap, &white_color, FALSE, TRUE);

  page_style->fg[GTK_STATE_NORMAL]   = black_color;
  page_style->text[GTK_STATE_NORMAL] = black_color;
  page_style->bg[GTK_STATE_NORMAL]   = white_color;

  /*
  gdk_font_unref(page_style->font);
  page_style->font = dialog->style->font;
  gdk_font_ref(page_style->font);
  */

  /*  B/Colored Style for the page title  */
  title_style = gtk_style_copy(page_style);

  if (gdk_color_parse("royal blue", &title_color) && gdk_colormap_alloc_color(colormap, &title_color, FALSE, TRUE))
  {
    title_style->bg[GTK_STATE_NORMAL] = title_color;
  }

  large_font_desc = pango_font_description_from_string ("sans bold 20");
  if (large_font_desc)
  {
    title_style->font_desc = large_font_desc;
  }

  /*  W/W GC for the corner  */
  white_gc = gdk_gc_new(dialog->window);
  gdk_gc_set_foreground(white_gc, &white_color);

  TITLE_STYLE(dialog);

  footer_label = gtk_label_new(NULL);
  PAGE_STYLE(footer_label);
  gtk_label_set_justify(GTK_LABEL(footer_label), GTK_JUSTIFY_RIGHT);
  gtk_box_pack_start(GTK_BOX(action_area), footer_label, FALSE, FALSE, 8);
  gtk_widget_show(footer_label);


  vbox = gtk_vbox_new(FALSE, 0);
  gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), vbox);

  ebox = gtk_event_box_new();
  TITLE_STYLE(ebox);
  gtk_widget_set_events(ebox, GDK_EXPOSURE_MASK);
  gtk_widget_set_size_request(ebox, WILBER_WIDTH + 16, -1);
  gtk_box_pack_start(GTK_BOX(vbox), ebox, FALSE, FALSE, 0);
  gtk_widget_show(ebox);

  hbox = gtk_hbox_new(FALSE, 8);
  gtk_container_set_border_width(GTK_CONTAINER(hbox), 8);
  gtk_container_add(GTK_CONTAINER(ebox), hbox);
  gtk_widget_show(hbox);

  title_pixmap = create_pixmap(dialog,gabedit_xpm);
  gtk_box_pack_start(GTK_BOX(hbox), title_pixmap, FALSE, FALSE, 8);
  gtk_widget_show(title_pixmap);

  title_label = gtk_label_new(NULL);
  TITLE_STYLE(title_label);
  gtk_label_set_justify(GTK_LABEL(title_label), GTK_JUSTIFY_LEFT);
  gtk_box_pack_start(GTK_BOX(hbox), title_label, FALSE, FALSE, 0);
  gtk_widget_show(title_label);

  hbox = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
  gtk_widget_show(hbox);

  ebox = gtk_event_box_new();
  TITLE_STYLE(ebox);
  gtk_widget_set_size_request(ebox, 16, -1);
  gtk_box_pack_start(GTK_BOX(hbox), ebox, FALSE, FALSE, 0);
  gtk_widget_show(ebox);

  ebox = gtk_event_box_new();
  PAGE_STYLE(ebox);
  gtk_box_pack_start(GTK_BOX(hbox), ebox, TRUE, TRUE, 0);
  gtk_widget_show(ebox);

  table = gtk_table_new(3, 3, FALSE);
  gtk_table_set_col_spacing(GTK_TABLE(table), 1, 8);
  gtk_container_add(GTK_CONTAINER(ebox), table);
  gtk_widget_show(table);

  darea = gtk_drawing_area_new();
  TITLE_STYLE(darea);
  gtk_widget_set_size_request(GTK_WIDGET(darea), 16, 16);
  g_signal_connect_after(G_OBJECT(darea), "expose_event",
                           (GCallback)user_install_corner_expose,
                           (gpointer)GTK_CORNER_TOP_LEFT);
  gtk_table_attach(GTK_TABLE(table), darea, 0,1, 0,1,
                   GTK_SHRINK, GTK_SHRINK, 0, 0);
  gtk_widget_show(darea);

  darea = gtk_drawing_area_new();
  TITLE_STYLE(darea);
  gtk_widget_set_size_request(GTK_WIDGET(darea), 16, 16);
  g_signal_connect_after(G_OBJECT(darea), "expose_event",
                           (GCallback)user_install_corner_expose,
                           (gpointer)GTK_CORNER_BOTTOM_LEFT);
  gtk_table_attach(GTK_TABLE(table), darea, 0,1, 2,3,
                   GTK_SHRINK, GTK_SHRINK, 0, 0);
  gtk_widget_show(darea);

  notebook = gtk_notebook_new();
  gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
  gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), FALSE);
  gtk_table_attach_defaults(GTK_TABLE(table), notebook, 1,2, 1,2);
  gtk_widget_show(notebook);

  gtk_widget_show(vbox);

  /*  Page 1  */
  temp = g_strdup_printf("Welcome to  The GABEDIT %s  User Installation",Version_S);
  g_free(Version_S);
  page = user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
				temp,
                                _("Click \"Continue\" to enter the GABEDIT user installation."));

  add_label(GTK_BOX(page),
            _(
            "Gabedit is a Graphical User Interface to FireFly, Gamess-US, Gaussian, Molcas, Molpro, \nMopac, MPQC , NWChem, Orca, Psicode and Q-Chem\n"
            "computational chemistry packages.\n"
	    "It can display a variety of calculation results including support for most major molecular file formats.\n"
	    "The advanced 'Molecule Builder' allows to rapidly sketch in molecules and examine them in 3D\n"
	    "Graphics can be exported to various formats, including animations\n"
	    "\n"
	    "Gabedit can creates input file for the computational chemistry packages(CCP) cited above.\n"
	    "Gabedit can graphically display a variety of the CCP calculation results\n"
	    "Gabedit can display UV-Vis, IR and Raman computed spectra.\n"
	    "Gabedit can generate a povray file for geometry, surfaces, contours, planes colorcoded.\n"
	    "Gabedit can save picture in BMP, JPEG, PNG, PPM, PDF and PS format.\n"
	    "It can generate automatically a series of pictures for animation(vibration, geometry convergence, ....).\n"
	    )
            );

  sep = gtk_hseparator_new();
  gtk_box_pack_start(GTK_BOX(page), sep, FALSE, FALSE, 2);
  gtk_widget_show(sep);

  add_label(GTK_BOX(page),
		  _(
		  "Copyright (c) 2002-2013 Abdul-Rahman Allouche.\n"
		  "All rights reserved.\n"
		  "\nGabedit is free.\n"
		  )
		  ); 

  /*  Page 2  */
  {
    GtkWidget *hbox;
    GtkWidget *vbox;
    GtkWidget *notebook2;
    GtkWidget *page2;
    GtkWidget *label;
    GtkTreeIter main_node;
    GtkTreeIter sub_node;
    gchar     *str;

    GtkTreeStore *store;
    GtkTreeModel *model;
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;
    GtkWidget* treeView;
    GtkTreeSelection *select;

    gint i;

    gchar *node[1];
    set_pixbuf();

    page = user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
		    			    _("Personal GABEDIT Directory"),
					    _(
                                             "Click \"Continue\" to create "
                                             "your personal GABEDIT directory.")
					    );

    hbox = gtk_hbox_new(FALSE, 8);
    gtk_box_pack_start(GTK_BOX(page), hbox, FALSE, FALSE, 0);
    gtk_widget_show(hbox);

    store = gtk_tree_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
    model = GTK_TREE_MODEL (store);

    treeView = gtk_tree_view_new_with_model (model);
    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeView), FALSE);
    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeView), FALSE);
    PAGE_STYLE(treeView);

    column = gtk_tree_view_column_new ();
    gtk_tree_view_column_set_title (column, " ");
    gtk_tree_view_column_set_reorderable(column, FALSE);

    renderer = gtk_cell_renderer_pixbuf_new ();
    gtk_tree_view_column_pack_start (column, renderer, FALSE);
    gtk_tree_view_column_add_attribute (column, renderer, "pixbuf", LIST_PIXBUF);

    renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_column_pack_start (column, renderer, TRUE);
    gtk_tree_view_column_add_attribute (column, renderer, "text", LIST_NAME);

    gtk_tree_view_append_column (GTK_TREE_VIEW (treeView), column);
    gtk_box_pack_start(GTK_BOX(hbox), treeView, FALSE, FALSE, 0);
    gtk_widget_show(treeView);

    vbox = gtk_vbox_new(FALSE, 6);
    gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
    gtk_widget_show(vbox);

    str = g_strdup_printf(_("For a proper GABEDIT installation, a subdirectory named\n"
                            "%s needs to be created."), gabedit_directory());
    add_label(GTK_BOX(vbox), str);
    g_free(str);

    add_label(GTK_BOX(vbox),
		    _(
              "This subdirectory will contain a number of important files.\n"
                "Click on one of the files or subdirectories in the tree\n"
                "to get more information about the selected item."
		    )
	);

    notebook2 = gtk_notebook_new();
    gtk_container_set_border_width(GTK_CONTAINER(notebook2), 8);
    gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook2), FALSE);
    gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook2), FALSE);
    gtk_box_pack_start(GTK_BOX(vbox), notebook2, TRUE, TRUE, 0);
    gtk_widget_show(notebook2);

    /*  empty page  */
    page2 = gtk_vbox_new(FALSE, 0);
    gtk_widget_show(page2);
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook2), page2, NULL);

    node[0] = (gchar *)gabedit_directory();

    gtk_tree_store_append(store, &main_node, NULL);
    gtk_tree_store_set (store, &main_node, LIST_NAME, node[0], -1);
    gtk_tree_store_set (store, &main_node, LIST_PIXBUF, bookPixbuf, -1);


    select = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeView));
    gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
    g_signal_connect (G_OBJECT (select), "changed", G_CALLBACK (user_install_treeview_select_row), notebook2);

    for (i = 0; i < num_tree_items; i++)
    {
      node[0] = tree_items[i].text;

      if (tree_items[i].directory)
      {
    		gtk_tree_store_append(store, &sub_node, &main_node);
    		gtk_tree_store_set (store, &sub_node, LIST_NAME, node[0], -1);
    		gtk_tree_store_set (store, &sub_node, LIST_PIXBUF, bookPixbuf, -1);
      } else
      {
    		gtk_tree_store_append(store, &sub_node, &main_node);
    		gtk_tree_store_set (store, &sub_node, LIST_NAME, node[0], -1);
    		gtk_tree_store_set (store, &sub_node, LIST_PIXBUF, pagePixbuf, -1);
      }

      page2 = gtk_vbox_new(FALSE, 0);
      label = gtk_label_new(tree_items[i].description);
      PAGE_STYLE(label);
      PAGE_STYLE(label);
      gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
      gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
      gtk_box_pack_start(GTK_BOX(page2), label, TRUE, TRUE, 0);
      gtk_widget_show(label);
      gtk_widget_show(page2);

      gtk_notebook_append_page(GTK_NOTEBOOK(notebook2), page2, NULL);
    }
    {
  	GtkTreePath *path = gtk_tree_path_new_from_string  ("0");
  	gtk_tree_view_expand_to_path(GTK_TREE_VIEW(treeView), path);
  	gtk_tree_path_free(path);
    }

  }

  /*  Page 3  */
  page = log_page = user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                             _("Creation of Directories"),
                                             NULL);

  /*  Page 4  */
  page = prop_page = user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                             _("GABEDIT Atoms Properties"),
                                             _("Click \"Continue\" to accept the settings above."));

  add_label(GTK_BOX(page),_("Setting for atoms properties."));

  sep = gtk_hseparator_new();
  gtk_box_pack_start(GTK_BOX(page), sep, FALSE, FALSE, 2);
  gtk_widget_show(sep);

  /*  Page 5  */
  page = commands_network_page = user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                             _("GABEDIT Commands/Network"),
                                             _("Click \"Continue\" to accept the settings above."));

  add_label(GTK_BOX(commands_network_page),
	    _(
            "To execute FireFly, Gamess-US, Gaussian, Molcas, Molpro, \nMopac, MPQC, NWChem, Orca, Psicode and Q-Chem program, "
            "GABEDIT needs to know commands system.\n"
            "GABEDIT needs to know network protocols.\n"
  	    "You can change them after installation (Settings/Preferences)."
	    )
	    );

  sep = gtk_hseparator_new();
  gtk_box_pack_start(GTK_BOX(page), sep, FALSE, FALSE, 2);
  gtk_widget_show (sep);

  /*  Page 6  */
  page = fontscolors_page =
           user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                             _("GABEDIT Fonts/Colors setting"),
                                             _("Click \"Continue\" to accept the settings above."));

  add_label(GTK_BOX(fontscolors_page),
	    _(
            "Setting for Text Font and Text Colors, "
            "GABEDIT needs to know the defaults Fonts/Colors for Data and Result editors."
	    )
	    );

  sep = gtk_hseparator_new();
  gtk_box_pack_start(GTK_BOX(page), sep, FALSE, FALSE, 2);
  gtk_widget_show (sep);

  /*  Page 7  */
  page = colorsurfaces_page =
           user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                             _("GABEDIT Color Surfaces setting"),
                                             _("Click \"Continue\" to accept the settings above."));

  add_label(GTK_BOX(colorsurfaces_page),
            _("Setting for color surfaces, "
            "GABEDIT needs to know the defaults Color for surfaces(density,Orbitals,....)."
	    )
	    );

  sep = gtk_hseparator_new();
  gtk_box_pack_start(GTK_BOX(page), sep, FALSE, FALSE, 2);
  gtk_widget_show (sep);

  /*  Page 8  */
  page = molpro_basis_page =
           user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                             _("GABEDIT creation of molpro basis list file"),
                                             _("Click \"Continue\" for next page."));
  add_label(GTK_BOX(molpro_basis_page),
		  _(
            "If the libmol program (delivered with molpro) is not installed on your local host,\n"
            "GABEDIT uses this file for get the list of basis(only the names of basis)supported by molpro.\n"
            "Please note that this file contains the list of basis supported by molpro2002.6."
	    )
	  );

  /*  Page 9  */
  page = molcas_basis_page =
           user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                             _("GABEDIT creation of molcas basis list file"),
                                             _("Click \"Continue\" for next page."));
  add_label(GTK_BOX(molcas_basis_page),
		  _(
            "GABEDIT uses this file for get the list of basis(only the names of basis)supported by molcas.\n"
            "Please note that this file contains the list of basis supported by Molcas7."
	    )
		  );

  /*  Page 10  */
  page = mpqc_basis_page =
           user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                             _("GABEDIT creation of mpqc basis list file"),
                                             _("Click \"Continue\" for next page."));
  add_label(GTK_BOX(mpqc_basis_page),
		  _(
            "GABEDIT uses this file for get the list of basis(only the names of basis)supported by MPQC.\n"
            "Please note that this file contains the list of basis supported by MPQC2.2.2."
	    )
	 );


    /*  Page 11  */
  page = mm_file_page =
  user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                     _("GABEDIT creation of Molecular Mechanics file"),
                                     _("Click \"Continue\" to start GABEDIT."));
  add_label(GTK_BOX(mm_file_page),
            _("Gabedit use this file for load molecular mechanics parameters "));

  /*  EEK page  */
  page = user_install_notebook_append_page(GTK_NOTEBOOK(notebook),
                                           _("Aborting Installation..."),
                                           NULL);

  user_install_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);

  create_buttons_dialog(dialog,callback);
  gtk_widget_show_all(dialog);
}