gtksourceview r2247 - in branches/gtksourcecompletion: . tests
- From: icq svn gnome org
- To: svn-commits-list gnome org
- Subject: gtksourceview r2247 - in branches/gtksourcecompletion: . tests
- Date: Wed, 8 Apr 2009 19:14:08 +0000 (UTC)
Author: icq
Date: Wed Apr 8 19:14:08 2009
New Revision: 2247
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=2247&view=rev
Log:
2009-04-08 Ignacio Casal Quinteiro <nacho resa gmail com>
* tests/completion-simple.c:
Use proper coding style.
Modified:
branches/gtksourcecompletion/ChangeLog
branches/gtksourcecompletion/tests/completion-simple.c
Modified: branches/gtksourcecompletion/tests/completion-simple.c
==============================================================================
--- branches/gtksourcecompletion/tests/completion-simple.c (original)
+++ branches/gtksourcecompletion/tests/completion-simple.c Wed Apr 8 19:14:08 2009
@@ -21,14 +21,6 @@
* Boston, MA 02110-1301, USA.
*/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <config.h>
-
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gtksourceview/gtksourceview.h>
@@ -49,7 +41,8 @@
static const gboolean change_keys = FALSE;
static void
-show_completion_cb (GtkWidget *w, gpointer user_data)
+show_completion_cb (GtkWidget *w,
+ gpointer user_data)
{
gint n;
gint pos;
@@ -69,7 +62,8 @@
}
static void
-hide_completion_cb (GtkWidget *w, gpointer user_data)
+hide_completion_cb (GtkWidget *w,
+ gpointer user_data)
{
}
@@ -78,12 +72,15 @@
filter_func (GtkSourceCompletionProposal *proposal,
gpointer user_data)
{
- const gchar *label = gtk_source_completion_proposal_get_label (proposal);
+ const gchar *label;
+
+ label = gtk_source_completion_proposal_get_label (proposal);
return g_str_has_prefix (label, "sp");
}
static void
-destroy_cb(GtkObject *object,gpointer user_data)
+destroy_cb (GtkObject *object,
+ gpointer user_data)
{
gtk_main_quit ();
}
@@ -92,35 +89,46 @@
activate_toggled_cb (GtkToggleButton *button,
gpointer user_data)
{
- g_object_set (comp, "active", gtk_toggle_button_get_active (button), NULL);
+ g_object_set (comp, "active",
+ gtk_toggle_button_get_active (button),
+ NULL);
}
static void
remember_toggled_cb (GtkToggleButton *button,
gpointer user_data)
{
- g_object_set (comp, "remember-info-visibility", gtk_toggle_button_get_active (button), NULL);
+ g_object_set (comp, "remember-info-visibility",
+ gtk_toggle_button_get_active (button),
+ NULL);
}
static void
select_on_show_toggled_cb (GtkToggleButton *button,
gpointer user_data)
{
- g_object_set (comp, "select-on-show", gtk_toggle_button_get_active (button), NULL);
+ g_object_set (comp, "select-on-show",
+ gtk_toggle_button_get_active (button),
+ NULL);
}
static gboolean
-key_press(GtkWidget *widget,
- GdkEventKey *event,
- gpointer user_data)
+key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data)
{
+ GdkModifierType mod;
+ guint key = 0;
+ guint s;
+
if (event->keyval == GDK_F9)
{
gtk_source_completion_filter_proposals (comp,
- filter_func,
- NULL);
+ filter_func,
+ NULL);
return TRUE;
- } else if (event->keyval == GDK_F8)
+ }
+ else if (event->keyval == GDK_F8)
{
GtkSourceCompletionInfo *gsc_info;
@@ -132,18 +140,18 @@
gtk_widget_show (GTK_WIDGET (gsc_info));
}
- guint key = 0;
- GdkModifierType mod;
gtk_accelerator_parse ("<Control>b", &key, &mod);
- guint s = event->state & gtk_accelerator_get_default_mod_mask();
+ s = event->state & gtk_accelerator_get_default_mod_mask ();
- if (s == mod && gdk_keyval_to_lower(event->keyval) == key)
+ if (s == mod && gdk_keyval_to_lower (event->keyval) == key)
{
if (!GTK_WIDGET_VISIBLE (info))
{
gchar *text;
- gchar *word = gsc_get_last_word (GTK_TEXT_VIEW (view));
+ gchar *word;
+
+ word = gsc_get_last_word (GTK_TEXT_VIEW (view));
text = g_strdup_printf ("<b>Calltip</b>: %s", word);
gtk_source_completion_info_set_markup (info, text);
@@ -170,15 +178,16 @@
GtkWidget *remember;
GtkWidget *select_on_show;
GtkWidget *label;
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_resize(GTK_WINDOW(window),600,400);
- vbox = gtk_vbox_new (FALSE,1);
- hbox = gtk_hbox_new (FALSE,1);
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_resize (GTK_WINDOW (window), 600, 400);
- view = gtk_source_view_new();
- GtkWidget *scroll = gtk_scrolled_window_new(NULL,NULL);
- gtk_container_add(GTK_CONTAINER(scroll),view);
+ vbox = gtk_vbox_new (FALSE, 1);
+ hbox = gtk_hbox_new (FALSE, 1);
+
+ view = gtk_source_view_new ();
+ GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (scroll), view);
activate = gtk_check_button_new_with_label ("Active");
remember = gtk_check_button_new_with_label ("Remember info visibility");
@@ -186,23 +195,31 @@
label = gtk_label_new ("F9 filter by \"sp\"\n<Control>b to show a calltip\nF8 show/hide info");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (activate), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (remember), FALSE);
- gtk_box_pack_start(GTK_BOX(hbox),label, TRUE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox),activate, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox),remember, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox),select_on_show, FALSE, FALSE, 0);
-
- gtk_box_pack_start(GTK_BOX(vbox),scroll, TRUE, TRUE, 0);
- gtk_box_pack_end(GTK_BOX(vbox),hbox, FALSE, FALSE, 0);
-
- gtk_container_add(GTK_CONTAINER(window),vbox);
-
- g_signal_connect(view, "key-release-event", G_CALLBACK(key_press), NULL);
-
- g_signal_connect(window, "destroy", G_CALLBACK(destroy_cb), NULL);
-
- g_signal_connect(activate,"toggled",G_CALLBACK(activate_toggled_cb),NULL);
- g_signal_connect(remember,"toggled",G_CALLBACK(remember_toggled_cb),NULL);
- g_signal_connect(select_on_show,"toggled",G_CALLBACK(select_on_show_toggled_cb),NULL);
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), activate, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), remember, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), select_on_show, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+
+ g_signal_connect (view, "key-release-event",
+ G_CALLBACK (key_press),
+ NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (destroy_cb),
+ NULL);
+ g_signal_connect (activate, "toggled",
+ G_CALLBACK (activate_toggled_cb),
+ NULL);
+ g_signal_connect (remember, "toggled",
+ G_CALLBACK (remember_toggled_cb),
+ NULL);
+ g_signal_connect (select_on_show, "toggled",
+ G_CALLBACK (select_on_show_toggled_cb),
+ NULL);
return window;
}
@@ -238,11 +255,11 @@
{
info = gtk_source_completion_info_new ();
gtk_source_completion_info_set_adjust_height (info,
- TRUE,
- -1);
+ TRUE,
+ -1);
gtk_source_completion_info_set_adjust_width (info,
- TRUE,
- -1);
+ TRUE,
+ -1);
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]