| 1 | /* This file is part of the Linux Trace Toolkit viewer |
| 2 | * Copyright (C) 2006 Mathieu Desnoyers |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License Version 2 as |
| 6 | * published by the Free Software Foundation; |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 16 | * MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | |
| 20 | #include "lttv_plugin_tab.h" |
| 21 | #include <lttvwindow/lttvwindow.h> |
| 22 | |
| 23 | /* |
| 24 | * forward definitions |
| 25 | */ |
| 26 | |
| 27 | /* |
| 28 | * Implementation |
| 29 | */ |
| 30 | |
| 31 | static void tab_update_filter(LttvPlugin *parent, LttvFilter *filter) |
| 32 | { |
| 33 | LttvPluginTab *self = LTTV_PLUGIN_TAB(parent); |
| 34 | g_message("In tab update filter."); |
| 35 | lttv_filter_destroy(self->tab->filter); |
| 36 | self->tab->filter = filter; |
| 37 | lttvwindow_report_filter(self->tab, filter); |
| 38 | } |
| 39 | |
| 40 | |
| 41 | static void |
| 42 | lttv_plugin_tab_class_init (LttvPluginTabClass *klass) |
| 43 | { |
| 44 | LttvPluginClass *parent_klass; |
| 45 | parent_klass = &klass->parent; |
| 46 | parent_klass->update_filter = tab_update_filter; |
| 47 | g_type_class_add_private (klass, sizeof (Tab)); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | static void |
| 52 | lttv_plugin_tab_init (GTypeInstance *instance, gpointer g_class) |
| 53 | { |
| 54 | LttvPluginTab *self = LTTV_PLUGIN_TAB (instance); |
| 55 | self->tab = G_TYPE_INSTANCE_GET_PRIVATE (self, |
| 56 | LTTV_TYPE_PLUGIN_TAB, Tab); |
| 57 | } |
| 58 | |
| 59 | |
| 60 | __EXPORT GType |
| 61 | lttv_plugin_tab_get_type (void) |
| 62 | { |
| 63 | static GType type = 0; |
| 64 | if (type == 0) { |
| 65 | static const GTypeInfo info = { |
| 66 | sizeof (LttvPluginTabClass), |
| 67 | NULL, /* base_init */ |
| 68 | NULL, /* base_finalize */ |
| 69 | lttv_plugin_tab_class_init, /* class_init */ |
| 70 | NULL, /* class_finalize */ |
| 71 | NULL, /* class_data */ |
| 72 | sizeof (LttvPluginTab), |
| 73 | 0, /* n_preallocs */ |
| 74 | lttv_plugin_tab_init /* instance_init */ |
| 75 | }; |
| 76 | type = g_type_register_static (G_TYPE_OBJECT, |
| 77 | "LttvPluginTabType", |
| 78 | &info, 0); |
| 79 | } |
| 80 | return type; |
| 81 | } |
| 82 | |
| 83 | |