Back to index

bamf  0.2.120
interaction-tester.c
Go to the documentation of this file.
00001 /*
00002  *
00003  * Copyright (C) 2009 - Canonical Ltd.
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 3 of the License
00008  *
00009  * Bamf is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor,
00017  * Boston, MA  02110-1301  USA
00018  */
00019 
00020 #include <stdio.h>
00021 #include <gtk/gtk.h>
00022 #include <gdk/gdk.h>
00023 #include <glib.h>
00024 #include <libbamf/libbamf.h>
00025 
00026 static GtkWidget *window;
00027 static BamfMatcher *matcher;
00028 static BamfControl *control;
00029 
00030 //static gboolean application_seen;
00031 
00032 static void destroy (GtkWidget *widget, gpointer data)
00033 {
00034   gtk_main_quit ();
00035 }
00036 
00037 static void handle_view_opened (BamfMatcher *matcher, BamfView *view, gpointer data)
00038 {
00039     return;
00040   
00041   
00042 }
00043 
00044 static void handle_view_closed (BamfMatcher *matcher, BamfView *view, gpointer data)
00045 {
00046 }
00047 
00048 //static void test_window_match_without_registration ()
00049 //{
00050 //  gtk_widget_show_all (window);
00051 //}
00052 
00053 //static void test_window_match_with_registration ()
00054 //{
00055 
00056 //}
00057 
00058 static void begin_testing ()
00059 {
00060 
00061 }
00062 
00063 int main (int argc, char **argv)
00064 {
00065   gtk_init (&argc, &argv);
00066 
00067   matcher = bamf_matcher_get_default ();
00068   control = bamf_control_get_default ();
00069 
00070   bamf_control_insert_desktop_file (control, g_build_filename (g_get_current_dir (), "interact-test.desktop", NULL));
00071 
00072   g_signal_connect (G_OBJECT (matcher), "view-opened",
00073                    (GCallback) handle_view_opened, NULL);
00074   
00075   g_signal_connect (G_OBJECT (matcher), "view-closed",
00076                    (GCallback) handle_view_closed, NULL);
00077 
00078   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
00079   gtk_window_set_wmclass (GTK_WINDOW (window), "interact-test", "interact-test");
00080 
00081   g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL);
00082   
00083   g_timeout_add (5000, (GSourceFunc) begin_testing, NULL);
00084 
00085   gtk_main ();
00086   return 0;
00087 }
00088 
00089 
00090 
00091 
00092 
00093 
00094