static void fm_places_view_class_init(FmPlacesViewClass *klass) { GObjectClass *g_object_class; GtkWidgetClass* widget_class; GtkTreeViewClass* tv_class; g_object_class = G_OBJECT_CLASS(klass); g_object_class->finalize = fm_places_view_finalize; widget_class = GTK_WIDGET_CLASS(klass); widget_class->button_press_event = on_button_press; widget_class->button_release_event = on_button_release; widget_class->drag_motion = on_drag_motion; widget_class->drag_leave = on_drag_leave; widget_class->drag_drop = on_drag_drop; widget_class->drag_data_received = on_drag_data_received; tv_class = GTK_TREE_VIEW_CLASS(klass); tv_class->row_activated = on_row_activated; tv_class->set_scroll_adjustments = on_set_scroll_adjustments; signals[CHDIR] = g_signal_new("chdir", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(FmPlacesViewClass, chdir), NULL, NULL, g_cclosure_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER); }
static gboolean exo_tree_view_move_cursor (GtkTreeView *view, GtkMovementStep step, gint count) { ExoTreeView *tree_view = EXO_TREE_VIEW (view); /* be sure to cancel any pending single-click timeout */ if (G_UNLIKELY (tree_view->priv->single_click_timeout_id >= 0)) g_source_remove (tree_view->priv->single_click_timeout_id); /* release and reset the hover path (if any) */ if (tree_view->priv->hover_path != NULL) { gtk_tree_path_free (tree_view->priv->hover_path); tree_view->priv->hover_path = NULL; } /* reset the cursor for the tree view internal window */ if (gtk_widget_get_realized (GTK_WIDGET (tree_view))) gdk_window_set_cursor (gtk_tree_view_get_bin_window (GTK_TREE_VIEW (tree_view)), NULL); /* call the parent's handler */ return (*GTK_TREE_VIEW_CLASS (exo_tree_view_parent_class)->move_cursor) (view, step, count); }
static void empathy_contact_list_view_class_init (EmpathyContactListViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkTreeViewClass *tree_view_class = GTK_TREE_VIEW_CLASS (klass); object_class->finalize = contact_list_view_finalize; object_class->get_property = contact_list_view_get_property; object_class->set_property = contact_list_view_set_property; widget_class->drag_data_received = contact_list_view_drag_data_received; widget_class->drag_drop = contact_list_view_drag_drop; widget_class->drag_begin = contact_list_view_drag_begin; widget_class->drag_data_get = contact_list_view_drag_data_get; widget_class->drag_end = contact_list_view_drag_end; widget_class->drag_motion = contact_list_view_drag_motion; /* We use the class method to let user of this widget to connect to * the signal and stop emission of the signal so the default handler * won't be called. */ tree_view_class->row_activated = contact_list_view_row_activated; signals[DRAG_CONTACT_RECEIVED] = g_signal_new ("drag-contact-received", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, _empathy_gtk_marshal_VOID__OBJECT_STRING_STRING, G_TYPE_NONE, 3, EMPATHY_TYPE_CONTACT, G_TYPE_STRING, G_TYPE_STRING); g_object_class_install_property (object_class, PROP_STORE, g_param_spec_object ("store", "The store of the view", "The store of the view", EMPATHY_TYPE_CONTACT_LIST_STORE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_LIST_FEATURES, g_param_spec_flags ("list-features", "Features of the view", "Falgs for all enabled features", EMPATHY_TYPE_CONTACT_LIST_FEATURE_FLAGS, EMPATHY_CONTACT_LIST_FEATURE_NONE, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_CONTACT_FEATURES, g_param_spec_flags ("contact-features", "Features of the contact menu", "Falgs for all enabled features for the menu", EMPATHY_TYPE_CONTACT_FEATURE_FLAGS, EMPATHY_CONTACT_FEATURE_NONE, G_PARAM_READWRITE)); g_type_class_add_private (object_class, sizeof (EmpathyContactListViewPriv)); }
static void _dtv_row_activated (GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column) { GtkTreeModel *model; GtkTreeIter iter; DiaObject *object; model = gtk_tree_view_get_model (view); if (gtk_tree_model_get_iter (model, &iter, path)) { gtk_tree_model_get (model, &iter, OBJECT_COLUMN, &object, -1); /* FIXME: g_signal_emit (view, signals[REVISION_ACTIVATED], 0, object); */ } if (GTK_TREE_VIEW_CLASS (_dtv_parent_class)->row_activated) GTK_TREE_VIEW_CLASS (_dtv_parent_class)->row_activated (view, path, column); }
static void _dtv_class_init (DiagramTreeViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkTreeViewClass *tree_view_class = GTK_TREE_VIEW_CLASS (klass); object_class->finalize = _dtv_finalize; widget_class->button_press_event = _dtv_button_press; widget_class->query_tooltip = _dtv_query_tooltip; tree_view_class->row_activated = _dtv_row_activated; }
/* Move the cursor (action signal) */ static gboolean tilem_disasm_view_move_cursor(GtkTreeView *tv, GtkMovementStep step, gint count) { TilemDisasmView *dv; g_return_val_if_fail(TILEM_IS_DISASM_VIEW(tv), FALSE); dv = TILEM_DISASM_VIEW(tv); if (!dv->dbg->emu->calc) return FALSE; switch (step) { case GTK_MOVEMENT_DISPLAY_LINES: if (count < 0) { if (move_up_lines(dv, -count)) return TRUE; } else { if (move_down_lines(dv, count)) return TRUE; } break; case GTK_MOVEMENT_PARAGRAPHS: case GTK_MOVEMENT_PARAGRAPH_ENDS: case GTK_MOVEMENT_PAGES: if (count < 0) move_up_pages(dv, -count); else move_down_pages(dv, count); return TRUE; case GTK_MOVEMENT_BUFFER_ENDS: move_bytes(dv, count * 0x4000); return TRUE; case GTK_MOVEMENT_LOGICAL_POSITIONS: case GTK_MOVEMENT_VISUAL_POSITIONS: case GTK_MOVEMENT_WORDS: case GTK_MOVEMENT_DISPLAY_LINE_ENDS: case GTK_MOVEMENT_HORIZONTAL_PAGES: default: break; } return (*GTK_TREE_VIEW_CLASS(parent_class)->move_cursor)(tv, step, count); }
/* Initialize the TilemDisasmView class */ static void tilem_disasm_view_class_init(TilemDisasmViewClass *klass) { GtkTreeViewClass *tv_class = GTK_TREE_VIEW_CLASS(klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); gtk_rc_parse_string(default_style); parent_class = g_type_class_peek_parent(klass); widget_class->style_set = &tilem_disasm_view_style_set; widget_class->size_request = &tilem_disasm_view_size_request; widget_class->size_allocate = &tilem_disasm_view_size_allocate; widget_class->button_press_event = &tilem_disasm_view_button_press; widget_class->popup_menu = &tilem_disasm_view_popup_menu; widget_class->unrealize = &tilem_disasm_view_unrealize; tv_class->move_cursor = &tilem_disasm_view_move_cursor; tv_class->row_activated = &tilem_disasm_view_row_activated; }
static void fm_places_view_class_init(FmPlacesViewClass *klass) { GObjectClass *g_object_class; GtkWidgetClass* widget_class; GtkTreeViewClass* tv_class; g_object_class = G_OBJECT_CLASS(klass); g_object_class->finalize = fm_places_view_finalize; widget_class = GTK_WIDGET_CLASS(klass); widget_class->button_press_event = on_button_press; widget_class->button_release_event = on_button_release; tv_class = GTK_TREE_VIEW_CLASS(klass); tv_class->row_activated = on_row_activated; signals[CHDIR] = g_signal_new("chdir", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(FmPlacesViewClass, chdir), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); }
static void on_set_scroll_adjustments(GtkTreeView* view, GtkAdjustment* hadj, GtkAdjustment* vadj) { /* we don't want scroll horizontally, so we pass NULL instead of hadj. */ fm_dnd_set_dest_auto_scroll(GTK_WIDGET(view), NULL, vadj); GTK_TREE_VIEW_CLASS(fm_places_view_parent_class)->set_scroll_adjustments(view, hadj, vadj); }
static void file_view_class_init (AnjutaFileViewClass *klass) { GObjectClass* object_class = G_OBJECT_CLASS (klass); GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); GtkTreeViewClass* tree_class = GTK_TREE_VIEW_CLASS(klass); g_type_class_add_private (klass, sizeof (AnjutaFileViewPrivate)); object_class->finalize = file_view_finalize; object_class->set_property = file_view_set_property; object_class->get_property = file_view_get_property; g_object_class_install_property (object_class, PROP_BASE_URI, g_param_spec_string ("base_uri", _("Base URI"), _("URI of the top-most path displayed"), NULL, G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); g_signal_new ("file-open", ANJUTA_TYPE_FILE_VIEW, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AnjutaFileViewClass, file_open), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT, NULL); g_signal_new ("current-file-changed", ANJUTA_TYPE_FILE_VIEW, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AnjutaFileViewClass, current_uri_changed), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT, NULL); g_signal_new ("show-popup-menu", ANJUTA_TYPE_FILE_VIEW, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AnjutaFileViewClass, show_popup_menu), NULL, NULL, file_view_cclosure_marshal_VOID__OBJECT_BOOLEAN_INT_INT, G_TYPE_NONE, 4, G_TYPE_OBJECT, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INT, NULL); tree_class->row_activated = file_view_row_activated; widget_class->key_press_event = file_view_key_press_event; widget_class->popup_menu = file_view_popup_menu; widget_class->button_press_event = file_view_button_press_event; /* Tooltips */ widget_class->query_tooltip = file_view_query_tooltip; /* Dnd */ widget_class->drag_data_get = file_view_drag_data_get; }
static void exo_tree_view_class_init (ExoTreeViewClass *klass) { GtkTreeViewClass *gtktree_view_class; GtkWidgetClass *gtkwidget_class; GObjectClass *gobject_class; /* add our private data to the class */ g_type_class_add_private (klass, sizeof (ExoTreeViewPrivate)); /* determine our parent type class */ exo_tree_view_parent_class = g_type_class_peek_parent (klass); gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = exo_tree_view_finalize; gobject_class->get_property = exo_tree_view_get_property; gobject_class->set_property = exo_tree_view_set_property; gtkwidget_class = GTK_WIDGET_CLASS (klass); gtkwidget_class->button_press_event = exo_tree_view_button_press_event; gtkwidget_class->button_release_event = exo_tree_view_button_release_event; gtkwidget_class->motion_notify_event = exo_tree_view_motion_notify_event; gtkwidget_class->leave_notify_event = exo_tree_view_leave_notify_event; gtkwidget_class->drag_begin = exo_tree_view_drag_begin; gtktree_view_class = GTK_TREE_VIEW_CLASS (klass); gtktree_view_class->move_cursor = exo_tree_view_move_cursor; /* initialize the library's i18n support */ /* _exo_i18n_init (); */ /** * ExoTreeView:single-click: * * %TRUE to activate items using a single click instead of a * double click. * * Since: 0.3.1.3 **/ g_object_class_install_property (gobject_class, PROP_SINGLE_CLICK, g_param_spec_boolean ("single-click", _("Single Click"), _("Whether the items in the view can be activated with single clicks"), FALSE, EXO_PARAM_READWRITE)); /** * ExoTreeView:single-click-timeout: * * The amount of time in milliseconds after which the hover row (the row * which is hovered by the mouse cursor) will be selected automatically * in single-click mode. A value of %0 disables the automatic selection. * * Since: 0.3.1.5 **/ g_object_class_install_property (gobject_class, PROP_SINGLE_CLICK_TIMEOUT, g_param_spec_uint ("single-click-timeout", _("Single Click Timeout"), _("The amount of time after which the item under the mouse cursor will be selected automatically in single click mode"), 0, G_MAXUINT, 0, EXO_PARAM_READWRITE)); }