[gnome-devel-docs] tutorials C: Linkbutton sample code as well as page



commit c4ac4a0be888213587000a0add574a709d245d1e
Author: Monica Kochofar <monicakochofar gmail com>
Date:   Thu May 31 20:41:43 2012 -0400

    tutorials C: Linkbutton sample code as well as page

 platform-demos/C/linkbutton.c.page    |   34 +++++++++++++++++++++++++++++
 platform-demos/C/samples/linkbutton.c |   38 +++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/linkbutton.c.page b/platform-demos/C/linkbutton.c.page
new file mode 100644
index 0000000..3e06984
--- /dev/null
+++ b/platform-demos/C/linkbutton.c.page
@@ -0,0 +1,34 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<page xmlns="http://projectmallard.org/1.0/";
+      xmlns:xi="http://www.w3.org/2001/XInclude";
+      type="guide" style="task"
+      id="linkbutton.c">
+  <info>
+    <link type="guide" xref="beginner.c#buttons"/>
+    <revision version="0.1" date="2012-05-31" status="draft"/>
+
+    <credit type="author copyright">
+      <name>Monica Kochofar</name>
+      <email>monicakochofar gmail com</email>
+      <years>2012</years>
+    </credit>
+
+    <desc>Create buttons bound to a URL</desc>
+  </info>
+
+  <title>LinkButton Widget</title>
+
+  <media type="image" mime="image/png" src="media/linkbutton.png"/>
+  <p>This button links to the GNOME live webpage.</p>
+
+      <code mime="text/x-csrc" style="numbered">
+<xi:include href="samples/linkbutton.c" parse="text"><xi:fallback/></xi:include></code>
+<p>
+  In this sample we used the following:
+</p>
+<list>
+  <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkApplication.html";>GtkApplication</link></p></item>
+  <item><p><link href="http://developer.gnome.org/gtk3/3.4/GtkWindow.html";>GtkWindow</link></p></item>
+  <item><p><link href="http://developer.gnome.org/gtk/stable/GtkLinkButton.html#gtk-link-button-new";>GtkLinkButton</link></p></item>
+</list>
+</page>
diff --git a/platform-demos/C/samples/linkbutton.c b/platform-demos/C/samples/linkbutton.c
new file mode 100644
index 0000000..8bc18d2
--- /dev/null
+++ b/platform-demos/C/samples/linkbutton.c
@@ -0,0 +1,38 @@
+#include <gtk/gtk.h>
+
+
+static void
+activate (GtkApplication *app,
+          gpointer        user_data)
+{
+  GtkWidget *window;
+  GtkWidget *linkbutton;
+
+  window = gtk_application_window_new (app);
+
+  gtk_window_set_title (GTK_WINDOW (window), "GNOME LinkButton");
+  gtk_window_set_default_size (GTK_WINDOW (window), 250, 50);
+  
+  linkbutton = gtk_link_button_new ("Link to GNOME live!");
+  gtk_link_button_set_uri (GTK_LINK_BUTTON(linkbutton), "http://live.gnome.org";);
+
+  gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (linkbutton));
+
+  gtk_widget_show_all (window);
+}
+
+
+
+int
+main (int argc, char **argv)
+{
+  GtkApplication *app;
+  int status;
+
+  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
+  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
+  status = g_application_run (G_APPLICATION (app), argc, argv);
+  g_object_unref (app);
+
+  return status;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]