Back to index

indicator-appmenu  12.10.0
hudsource.c
Go to the documentation of this file.
00001 /*
00002  * Copyright © 2012 Canonical Ltd.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License version 3, as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License along
00014  * with this program.  If not, see <http://www.gnu.org/licenses/>.
00015  *
00016  * Author: Ryan Lortie <desrt@desrt.ca>
00017  */
00018 
00019 #define G_LOG_DOMAIN "hudsource"
00020 
00021 #include "hudsource.h"
00022 
00068 G_DEFINE_INTERFACE (HudSource, hud_source, G_TYPE_OBJECT)
00069 
00070 static gulong hud_source_changed_signal;
00071 
00072 static void
00073 hud_source_default_init (HudSourceInterface *iface)
00074 {
00083   hud_source_changed_signal = g_signal_new ("changed", HUD_TYPE_SOURCE, G_SIGNAL_RUN_LAST, 0, NULL,
00084                                             NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
00085 }
00086 
00102 void
00103 hud_source_use (HudSource *source)
00104 {
00105   g_return_if_fail (HUD_IS_SOURCE (source));
00106 
00107   g_debug ("use on %s %p", G_OBJECT_TYPE_NAME (source), source);
00108 
00109   HUD_SOURCE_GET_IFACE (source)
00110     ->use (source);
00111 }
00112 
00122 void
00123 hud_source_unuse (HudSource *source)
00124 {
00125   g_return_if_fail (HUD_IS_SOURCE (source));
00126 
00127   g_debug ("unuse on %s %p", G_OBJECT_TYPE_NAME (source), source);
00128 
00129   HUD_SOURCE_GET_IFACE (source)
00130     ->unuse (source);
00131 }
00132 
00146 void
00147 hud_source_search (HudSource    *source,
00148                    GPtrArray    *results_array,
00149                    HudTokenList *search_string)
00150 {
00151   g_debug ("search on %s %p", G_OBJECT_TYPE_NAME (source), source);
00152 
00153   HUD_SOURCE_GET_IFACE (source)
00154     ->search (source, results_array, search_string);
00155 }
00156 
00167 void
00168 hud_source_changed (HudSource *source)
00169 {
00170   g_debug ("%s %p changed", G_OBJECT_TYPE_NAME (source), source);
00171 
00172   g_signal_emit (source, hud_source_changed_signal, 0);
00173 }