/*
 * Invokes the method /menu_cell_basic_header_draw/ with the text set as /get_header_text/.
 */
static void menu_draw_header_callback(GContext *ctx, const Layer *cell_layer, uint16_t section_index, void *data) {
  menu_cell_basic_header_draw(ctx, cell_layer, get_header_text(section_index));
}
Пример #2
0
static void 
starter_instance_init (Starter* wcm)
{
	GtkWidget *main_box;
	GtkWidget *alignment;
	GtkWidget *vbox1, *vbox2, *vbox;
	GtkWidget *hbox;
	GtkWidget *label;
	GError *error = NULL;
	gchar *logo;
	gchar *aux;
	const guint logo_offset = 20;

	wcm->priv = g_slice_new0 (StarterPrivate);

	wcm->priv->filename = g_strdup (_("Starter"));

	logo = g_build_filename (PACKAGE_PIXMAPS_DIR, LOGO_NAME, NULL);
	
	wcm->priv->logo = gdk_pixbuf_new_from_file (logo, &error);
	
	if (error != NULL)
	{
		g_warning ("%s", error->message);
		g_error_free (error);
		return;
	}

	wcm->priv->event_box = gtk_event_box_new ();
	gtk_widget_show (wcm->priv->event_box);
	g_signal_connect (wcm->priv->event_box, "expose-event",
					  G_CALLBACK (on_expose_event_cb), wcm);

	alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment),
							   logo_offset + gdk_pixbuf_get_height (wcm->priv->logo) + logo_offset,
							   0, logo_offset, 0);

	gtk_widget_show (alignment);
	gtk_container_add (GTK_CONTAINER (wcm->priv->event_box), alignment);
	
	main_box = gtk_hbox_new (FALSE, 35);
	gtk_widget_show (main_box);
	gtk_container_add (GTK_CONTAINER (alignment), main_box);

	/*
	 * vbox1
	 */
	vbox1 = gtk_vbox_new (FALSE, 6);
	gtk_widget_show (vbox1);
	gtk_box_pack_start (GTK_BOX (main_box), vbox1, FALSE, FALSE, 0);
	
	/*
	 * FILE/PROJECT
	 */
	label = gtk_label_new (NULL);
	aux = get_header_text (_("Create File/Project"));
	gtk_label_set_markup (GTK_LABEL (label), aux);
	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
	g_free (aux);
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);
	
	hbox = gtk_hbox_new (FALSE, 6);
	gtk_widget_show (hbox);
	gtk_box_pack_start (GTK_BOX (vbox1), hbox, FALSE, FALSE, 0);
	
	label = gtk_label_new ("    ");
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
	
	wcm->priv->file_box = gtk_vbox_new (FALSE, 6);
	gtk_widget_show (wcm->priv->file_box);
	gtk_box_pack_start (GTK_BOX (hbox), wcm->priv->file_box, FALSE, FALSE, 0);
	
	wcm->priv->new_file = anjuta_starter_button_new (_("New File"));
	gtk_widget_show (wcm->priv->new_file);
	gtk_box_pack_start (GTK_BOX (wcm->priv->file_box), wcm->priv->new_file, TRUE, TRUE, 0);
	g_signal_connect (wcm->priv->new_file, "clicked",
					  G_CALLBACK (new_file_clicked_cb), wcm);
	
	/* Separator */
	label = gtk_label_new ("");
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);
	
	/*
	 * Recent Projects
	 */
	label = gtk_label_new (NULL);
	aux = get_header_text (_("Recent Projects"));
	gtk_label_set_markup (GTK_LABEL (label), aux);
	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
	g_free (aux);
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);
	
	hbox = gtk_hbox_new (FALSE, 6);
	gtk_widget_show (hbox);
	gtk_box_pack_start (GTK_BOX (vbox1), hbox, FALSE, FALSE, 0);
	
	label = gtk_label_new ("    ");
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);

	wcm->priv->recent_projects = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (wcm->priv->recent_projects);
	gtk_box_pack_start (GTK_BOX (hbox), wcm->priv->recent_projects, FALSE, FALSE, 0);
	build_recent_projects (wcm->priv->recent_projects, wcm);
	
	/*
	 * vbox2
	 */
	vbox2 = gtk_vbox_new (FALSE, 6);
	gtk_widget_show (vbox2);
	gtk_box_pack_start (GTK_BOX (main_box), vbox2, FALSE, FALSE, 0);

	/*
	 * Links
	 */
	label = gtk_label_new (NULL);
	aux = get_header_text (_("Links"));
	gtk_label_set_markup (GTK_LABEL (label), aux);
	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
	g_free (aux);
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
	
	hbox = gtk_hbox_new (FALSE, 6);
	gtk_widget_show (hbox);
	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
	
	label = gtk_label_new ("    ");
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);

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

	wcm->priv->anjuta_page = anjuta_starter_button_new (_("Anjuta Home Page"));
	gtk_widget_show (wcm->priv->anjuta_page);
	gtk_box_pack_start (GTK_BOX (vbox), wcm->priv->anjuta_page, TRUE, TRUE, 0);
	g_signal_connect (wcm->priv->anjuta_page, "clicked",
					  G_CALLBACK (anjuta_page_clicked_cb), NULL);

	wcm->priv->anjuta_manual = anjuta_starter_button_new (_("Anjuta Manual"));
	gtk_widget_show (wcm->priv->anjuta_manual);
	gtk_box_pack_start (GTK_BOX (vbox), wcm->priv->anjuta_manual, TRUE, TRUE, 0);
	g_signal_connect (wcm->priv->anjuta_manual, "clicked",
					  G_CALLBACK (anjuta_manual_clicked_cb), NULL);

	wcm->priv->gnome_library = anjuta_starter_button_new (_("GNOME Online API Documentation"));
	gtk_widget_show (wcm->priv->gnome_library);
	gtk_box_pack_start (GTK_BOX (vbox), wcm->priv->gnome_library, TRUE, TRUE, 0);
	g_signal_connect (wcm->priv->gnome_library, "clicked",
					  G_CALLBACK (gnome_library_clicked_cb), NULL);

	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wcm),
									GTK_POLICY_AUTOMATIC,
									GTK_POLICY_AUTOMATIC);
}