static gboolean prefs_custom_header_selected(GtkTreeSelection *selector, GtkTreeModel *model, GtkTreePath *path, gboolean currently_selected, gpointer data) { GtkTreeIter iter; CustomHeader *ch; GtkImage *preview; GdkPixbuf *pixbuf; CustomHeader default_ch = { 0, "", NULL }; if (currently_selected) return TRUE; if (!gtk_tree_model_get_iter(model, &iter, path)) return TRUE; gtk_tree_model_get(model, &iter, CUSTHDR_DATA, &ch, -1); if (!ch) ch = &default_ch; ENTRY_SET_TEXT(customhdr.hdr_entry, ch->name); ENTRY_SET_TEXT(customhdr.val_entry, ch->value); if (!strcmp2("Face",ch->name)) { preview = GTK_IMAGE(face_get_from_header (ch->value)); pixbuf = gtk_image_get_pixbuf(preview); gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf); gtk_widget_show(customhdr.preview); #if GLIB_CHECK_VERSION(2,10,0) g_object_ref_sink (G_OBJECT(preview)); #else gtk_object_ref (G_OBJECT(preview)); gtk_object_sink (G_OBJECT(preview)); #endif } #if HAVE_LIBCOMPFACE else if (!strcmp2("X-Face", ch->name)) { preview = GTK_IMAGE(xface_get_from_header(ch->value)); pixbuf = gtk_image_get_pixbuf(preview); gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf); gtk_widget_show(customhdr.preview); #if GLIB_CHECK_VERSION(2,10,0) g_object_ref_sink (G_OBJECT(preview)); #else gtk_object_ref (G_OBJECT(preview)); gtk_object_sink (G_OBJECT(preview)); #endif } #endif else { gtk_widget_hide(customhdr.preview); } return TRUE; }
static gint cb_thumbview_button_press (GtkWidget * widget, GdkEventButton * event, ThumbView * tv) { if (ZALBUM (tv->album)->len == 0 || ZLIST (tv->album)->focus < 0) return FALSE; gtk_widget_grab_focus (GTK_WIDGET (tv->album)); if (event->type == GDK_BUTTON_PRESS && event->button == 3) { gint type; guint n_menu_items; GtkWidget *popup_menu, *progs_submenu, *scripts_submenu; GtkWidget *menuitem; GtkItemFactory *ifactory; /* * create popup menu */ n_menu_items = sizeof (thumbview_popupmenu_items) / sizeof (thumbview_popupmenu_items[0]) - 1; popup_menu = menu_create_items (BROWSER_WINDOW, thumbview_popupmenu_items, n_menu_items, "<ThumbnailButtonPop>", tv); ifactory = gtk_item_factory_from_widget (popup_menu); type = (gint) zalbum_get_cell_data (ZALBUM (tv->album), tv->current); thumbview_update_popupmenu (type, ifactory); menuitem = gtk_item_factory_get_item (ifactory, "/Open in External Program"); progs_submenu = create_progs_submenu (tv); menu_set_submenu (popup_menu, "/Open in External Program", progs_submenu); menuitem = gtk_item_factory_get_item (ifactory, "/Scripts"); scripts_submenu = create_scripts_submenu (tv); menu_set_submenu (popup_menu, "/Scripts", scripts_submenu); gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL, NULL, NULL, event->button, event->time); #ifdef USE_GTK2 gtk_object_ref (GTK_OBJECT (popup_menu)); gtk_object_sink (GTK_OBJECT (popup_menu)); #endif gtk_widget_unref (popup_menu); return TRUE; } tv->current = ZLIST (tv->album)->focus; return FALSE; }
void init_display() { int i; pcb.scale = 1.0; for (i = 0; i < pcb.layers; i++) { pcb.layer[i].canvas = GOO_CANVAS(goo_canvas_new()); gtk_object_ref(GTK_OBJECT(pcb.layer[i].canvas)); goo_canvas_set_bounds(pcb.layer[i].canvas, 0, 0, pcb.width, pcb.height); pcb.layer[i].root = goo_canvas_get_root_item(pcb.layer[i].canvas); goo_canvas_image_new(pcb.layer[i].root, pcb.layer[i].img, 0, 0, NULL); init_layer_events(pcb.layer[i].root); show_overlays(i); } pcb.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(pcb.window), 800, 600); gtk_window_set_title(GTK_WINDOW(pcb.window), pcb.filename); init_window_events(pcb.window); pcb.scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(pcb.scrolled); gtk_container_add(GTK_CONTAINER(pcb.window), pcb.scrolled); redisplay(); }
static void hippo_canvas_widget_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { HippoCanvasWidget *widget; widget = HIPPO_CANVAS_WIDGET(object); switch (prop_id) { case PROP_WIDGET: { GtkWidget *w = (GtkWidget*) g_value_get_object(value); if (widget->widget != w) { if (w) { gtk_object_ref(GTK_OBJECT(w)); gtk_object_sink(GTK_OBJECT(w)); } if (widget->widget) g_object_unref(widget->widget); widget->widget = w; update_widget_visibility(widget); hippo_canvas_item_emit_request_changed(HIPPO_CANVAS_ITEM(widget)); } } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } }
void scope_group_set_num_channels (ScopeGroup *s, int num_channels) { int i; // Remove superfluous scopes from table for(i = num_channels; i < s->numchan; i++) { gtk_container_remove(GTK_CONTAINER(s->table), s->scopebuttons[i]); } // Resize table gtk_table_resize(GTK_TABLE(s->table), 2, num_channels / 2); // Add new scopes to table for(i = s->numchan; i < num_channels; i++) { gtk_object_ref(GTK_OBJECT(s->scopebuttons[i])); gtk_table_attach_defaults(GTK_TABLE(s->table), s->scopebuttons[i], i / 2, i / 2 + 1, i % 2, i % 2 + 1); } // Reset all buttons (enable all channels) for(i = 0; i < 32; i++) { gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(s->scopebuttons[i]), 1); #ifndef NO_GDK_PIXBUF gtk_widget_hide (s->mutedpic[i]); if (s->scopes_on) gtk_widget_show (GTK_WIDGET(s->scopes[i])); #endif } s->numchan = num_channels; s->on_mask = 0xFFFFFFFF; /* all channels are on */ }
void bst_canvas_link_set_icsource (BstCanvasLink *clink, BstCanvasSource *icsource, guint ichannel) { g_return_if_fail (BST_IS_CANVAS_LINK (clink)); if (icsource) g_return_if_fail (BST_CANVAS_SOURCE (icsource)); if (clink->icsource) { if (clink->icsource->source) /* source may be destroyed already */ bse_proxy_disconnect (clink->icsource->source, "any_signal", clink_view_check_update, clink, NULL); if (g_signal_handler_is_connected (clink->icsource, clink->ic_handler)) gtk_signal_disconnect (GTK_OBJECT (clink->icsource), clink->ic_handler); gtk_object_unref (GTK_OBJECT (clink->icsource)); } clink->icsource = icsource; clink->ichannel = ichannel; if (clink->icsource) { gtk_object_ref (GTK_OBJECT (clink->icsource)); clink->ic_handler = gtk_signal_connect_object (GTK_OBJECT (clink->icsource), "notify", G_CALLBACK (bst_canvas_link_update), GTK_OBJECT (clink)); bse_proxy_connect (clink->icsource->source, "swapped_signal::property-notify::uname", clink_view_check_update, clink, NULL); bst_canvas_link_update (clink); } }
GtkWidget *create_video_sliders() { GtkWidget *hbox, *vbox, *pixmap, *scrollbar; GtkTooltips *tooltip; int i=0; char *titles[4] = { "Hue", "Contrast", "Brightness", "Colour Saturation" }; char *names[4] = { "hue", "contrast", "brightness", "colour" }; GtkAdjustment *adj[4] = { GTK_TVPLUG(tv)->hue_adj, GTK_TVPLUG(tv)->contrast_adj, GTK_TVPLUG(tv)->brightness_adj, GTK_TVPLUG(tv)->saturation_adj, }; char **pixmaps[4] = { slider_hue_xpm, slider_contrast_xpm, slider_brightness_xpm, slider_sat_colour_xpm, }; tooltip = gtk_tooltips_new(); hbox = gtk_hbox_new(TRUE, 20); for (i=0;i<4;i++) { vbox = gtk_vbox_new (FALSE, 0); gtk_object_ref(GTK_OBJECT(adj[i])); gtk_signal_connect(GTK_OBJECT(adj[i]), "value_changed", GTK_SIGNAL_FUNC(video_slider_changed), names[i]); scrollbar = gtk_vscale_new(adj[i]); gtk_scale_set_draw_value(GTK_SCALE(scrollbar), 0); gtk_box_pack_start(GTK_BOX (vbox), scrollbar, TRUE, TRUE, 10); gtk_widget_show(scrollbar); gtk_widget_set_usize(scrollbar, -1, 150); gtk_tooltips_set_tip(tooltip, scrollbar, titles[i], NULL); pixmap = gtk_widget_from_xpm_data(pixmaps[i]); gtk_widget_show(pixmap); gtk_box_pack_start(GTK_BOX(vbox), pixmap, FALSE, FALSE, 10); gtk_box_pack_start(GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_widget_show(vbox); } return hbox; }
void clrimg (GtkImage *img) { GtkImageType itype; //if ((itype = gtk_image_get_storage_type (img)) == GTK_IMAGE_PIXBUF ) if (img != NULL) { gtk_object_ref (GTK_OBJECT (img)); gtk_container_remove (GTK_CONTAINER (fme), GTK_WIDGET (img)); //gtk_image_clear (img); } fprintf (stderr, "GTK_IMAGE_TYPE = %d\n", itype); }
/** * c2_filter_match_mailbox_full * @mailbox: Mailbox where to work. * @func: Callback function (might be %NULL). * @...: List of rules to apply ending with a %NULL. * * Return Value: * The list of mails that apply to the rule(s) in Virtual DB. **/ C2VDb * c2_filter_match_mailbox_full (C2Mailbox *mailbox, C2FilterCallback func, ...) { va_list args; GSList *list = NULL; C2Db *head = NULL, *l; /* Create the list of rules */ va_start (args, func); for (;;) { C2FilterRule *rule = va_arg (args, C2FilterRule*); if (!rule) break; list = g_slist_append (list, rule); } va_end (args); if (mailbox->db) { l = mailbox->db; do { C2Message *message; C2VDb *vdb; gboolean retval; if (c2_db_load_message (l) < 0) continue; message = l->message; gtk_object_ref (GTK_OBJECT (message)); retval = match_message_full (message, list); gtk_object_unref (GTK_OBJECT (message)); if (retval) { vdb = c2_vdb_new (l); c2_vdb_append (head, vdb); } } while (c2_db_lineal_next (l)); } g_slist_free (list); return head; }
static void typeradio_changed (void) { int n = find_current_toggle(typeradio, DIALOG_LAST); if(fileops_current_dialog) { gtk_container_remove(GTK_CONTAINER(rightbox), fileops_current_dialog->main_vbox); fileops_filesel_post_removal(fileops_current_dialog); gtk_container_add(GTK_CONTAINER(fileops_current_dialog), fileops_current_dialog->main_vbox); } fileops_current_dialog = GTK_FILE_SELECTION(fileops_dialogs[n]); fileops_refresh_list(GTK_FILE_SELECTION(fileops_dialogs[n]), FALSE); gtk_widget_hide(GTK_WIDGET(fileops_current_dialog)); /* close window if it's open */ gtk_object_ref(GTK_OBJECT(fileops_current_dialog->main_vbox)); gtk_container_remove(GTK_CONTAINER(fileops_current_dialog), fileops_current_dialog->main_vbox); fileops_filesel_pre_insertion(fileops_current_dialog); gtk_box_pack_start(GTK_BOX(rightbox), fileops_current_dialog->main_vbox, TRUE, TRUE, 0); fileops_refresh_list(fileops_current_dialog, FALSE); }
gint c2_smtp_send_message (C2SMTP *smtp, C2Message *message, const gint id) { C2NetObjectByte *byte = NULL; gchar *buffer; gtk_object_ref (GTK_OBJECT (message)); smtp->uses++; if(!smtp->in_use.lock) c2_mutex_lock(&smtp->in_use); if(smtp->type == C2_SMTP_REMOTE) { c2_mutex_lock(&smtp->lock); if(smtp->flags & C2_SMTP_DO_PERSIST) byte = smtp->persistent; if(!byte) { if(c2_smtp_connect(smtp, &byte) < 0) { smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, -1); return -1; } } if(smtp->flags & C2_SMTP_DO_PERSIST) smtp->persistent = byte; else smtp->persistent = NULL; if(smtp->flags & C2_SMTP_DO_NOT_PERSIST) c2_mutex_unlock(&smtp->lock); if(c2_smtp_send_headers(smtp, byte, message) < 0) { smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, -1); return -1; } if(c2_smtp_send_message_contents(smtp, byte, message, id) < 0) { smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, -1); return -1; } if(c2_net_object_send(C2_NET_OBJECT(smtp), byte, "\r\n.\r\n") < 0) { c2_smtp_set_error(smtp, SOCK_WRITE_FAILED); smtp_disconnect(smtp, byte); smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, -1); return -1; } if(c2_net_object_read(C2_NET_OBJECT(smtp), &buffer, byte) < 0) { c2_smtp_set_error(smtp, SOCK_READ_FAILED); smtp_disconnect(smtp, byte); smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, -1); return -1; } if(!c2_strneq(buffer, "250", 3)) { c2_smtp_set_error(smtp, _("SMTP server did not respond to our sent message in a friendly way")); g_free(buffer); smtp_disconnect(smtp, byte); smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, -1); return -1; } if(smtp->flags & C2_SMTP_DO_NOT_PERSIST) smtp_disconnect(smtp, byte); else c2_mutex_unlock(&smtp->lock); g_free(buffer); } else if(smtp->type == C2_SMTP_LOCAL) { gchar *file_name, *from, *to, *temp, *cmd; smtp->uses++; if(!smtp->in_use.lock) c2_mutex_lock(&smtp->in_use); file_name = c2_get_tmp_file (NULL); if(c2_smtp_local_write_msg(message, file_name) < 0) { g_free(file_name); c2_smtp_set_error(smtp, _("System Error: Unable to write message to disk for local SMTP command")); smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, -1); return -1; } /* get the proper to and from headers */ if(!(from = c2_message_get_header_field(message, "From: ")) || !(to = c2_smtp_local_get_recepients(message))) { c2_smtp_set_error(smtp, _("Internal C2 Error: Unable to fetch headers in email message")); unlink(file_name); if(from) g_free(from); g_free(file_name); smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, -1); return -1; } cmd = g_strdup(smtp->smtp_local_cmd); temp = cmd; cmd = c2_str_replace_all(cmd, "%m", file_name); g_free(temp); temp = cmd; cmd = c2_str_replace_all(cmd, "%f", from); g_free(temp); temp = cmd; cmd = c2_str_replace_all(cmd, "%t", to); g_free(temp); g_free(to); g_free(from); /* FINALLY execute the command :-) */ if(system(cmd) < 0) { c2_smtp_set_error(smtp, _("Problem running local SMTP command to send messages -- Check SMTP settings")); unlink(file_name); g_free(file_name); g_free(cmd); smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, -1); return -1; } gtk_signal_emit(GTK_OBJECT(smtp), signals[SMTP_UPDATE], id, 1, 1); g_free(file_name); g_free(cmd); unlink(file_name); } gtk_object_unref (GTK_OBJECT (message)); smtp->uses--; if(!smtp->uses) c2_mutex_unlock(&smtp->in_use); gtk_signal_emit(GTK_OBJECT(smtp), signals[FINISHED], id, 1); return 0; }
CSimple3DView::CSimple3DView(CSimple3DDatabase& rSimple3DDatabase) : m_rSimple3DDatabase(rSimple3DDatabase), m_pBuilderInterface(NULL), m_pCreateObjectTable(NULL), m_pCreateObjectName(NULL), m_pCreateObjectStandardRadioButton(NULL), m_pStandardObjectComboBox(NULL), m_pCustomObjectEntry(NULL), m_pDeleteObjectTable(NULL), m_pDeleteObjectName(NULL), m_pSetPositionTable(NULL), m_pPositionObjectName(NULL), m_pXPositionEntry(NULL), m_pYPositionEntry(NULL), m_pZPositionEntry(NULL), m_pSetScaleTable(NULL), m_pScaleObjectName(NULL), m_pXScaleEntry(NULL), m_pYScaleEntry(NULL), m_pZScaleEntry(NULL), m_pSetColorTable(NULL), m_pColorObjectName(NULL), m_pRedEntry(NULL), m_pGreenEntry(NULL), m_pBlueEntry(NULL), m_pTransparencyEntry(NULL) { //load the gtk builder interface m_pBuilderInterface=gtk_builder_new(); // glade_xml_new("../share/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-Simple3DDisplay.ui", NULL, NULL); gtk_builder_add_from_file(m_pBuilderInterface, "../share/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-Simple3DDisplay.ui", NULL); if(!m_pBuilderInterface) { g_warning("Couldn't load the interface!"); return; } gtk_builder_connect_signals(m_pBuilderInterface, NULL); //toolbar buttons connections g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "CreateObject")), "clicked", G_CALLBACK(createObjectButtonCallback), this); g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "DeleteObject")), "clicked", G_CALLBACK(deleteObjectButtonCallback), this); g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "SetPosition")), "clicked", G_CALLBACK(setPositionButtonCallback), this);/* g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "SetOrientation")), "clicked", G_CALLBACK(setOrientationButtonCallback), this);*/ g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "SetScale")), "clicked", G_CALLBACK(setScaleButtonCallback), this); g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "SetColor")), "clicked", G_CALLBACK(setColorButtonCallback), this); g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "RepositionCamera")), "clicked", G_CALLBACK(repositionCameraButtonCallback), this); //create object connections //------------------------- m_pCreateObjectTable = GTK_TABLE(gtk_builder_get_object(m_pBuilderInterface, "CreateObjectTable")); //remove table from its parent gtk_object_ref(GTK_OBJECT(m_pCreateObjectTable)); GtkWidget* l_pTableParent = gtk_widget_get_parent(GTK_WIDGET(m_pCreateObjectTable)); if(l_pTableParent != NULL && GTK_IS_CONTAINER(l_pTableParent)) { gtk_container_remove(GTK_CONTAINER(l_pTableParent), GTK_WIDGET(m_pCreateObjectTable)); } m_pCreateObjectName = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "CreateObjectName")); m_pCreateObjectStandardRadioButton = GTK_RADIO_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "CreateObjectStandard")); std::vector<std::string> l_oStandardObjectComboBoxEntries; l_oStandardObjectComboBoxEntries.push_back("Sphere"); l_oStandardObjectComboBoxEntries.push_back("Cone"); m_pStandardObjectComboBox = createTextComboBox("StandardObjectComboBoxTable", l_oStandardObjectComboBoxEntries); m_pCustomObjectEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "CustomObjectEntry")); //delete object connections //------------------------- m_pDeleteObjectTable = GTK_TABLE(gtk_builder_get_object(m_pBuilderInterface, "DeleteObjectTable")); //remove table from its parent gtk_object_ref(GTK_OBJECT(m_pDeleteObjectTable)); l_pTableParent = gtk_widget_get_parent(GTK_WIDGET(m_pDeleteObjectTable)); if(l_pTableParent != NULL && GTK_IS_CONTAINER(l_pTableParent)) { gtk_container_remove(GTK_CONTAINER(l_pTableParent), GTK_WIDGET(m_pDeleteObjectTable)); } m_pDeleteObjectName = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "DeleteObjectName")); //set position connections //------------------------ m_pSetPositionTable = GTK_TABLE(gtk_builder_get_object(m_pBuilderInterface, "SetPositionTable")); //remove table from its parent gtk_object_ref(GTK_OBJECT(m_pSetPositionTable)); l_pTableParent = gtk_widget_get_parent(GTK_WIDGET(m_pSetPositionTable)); if(l_pTableParent != NULL && GTK_IS_CONTAINER(l_pTableParent)) { gtk_container_remove(GTK_CONTAINER(l_pTableParent), GTK_WIDGET(m_pSetPositionTable)); } m_pPositionObjectName = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "PositionObjectName")); m_pXPositionEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "XPositionEntry")); m_pYPositionEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "YPositionEntry")); m_pZPositionEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "ZPositionEntry")); //set orientation connections //--------------------------- //TODO! //set scale connections //--------------------- m_pSetScaleTable = GTK_TABLE(gtk_builder_get_object(m_pBuilderInterface, "SetScaleTable")); //remove table from its parent gtk_object_ref(GTK_OBJECT(m_pSetScaleTable)); l_pTableParent = gtk_widget_get_parent(GTK_WIDGET(m_pSetScaleTable)); if(l_pTableParent != NULL && GTK_IS_CONTAINER(l_pTableParent)) { gtk_container_remove(GTK_CONTAINER(l_pTableParent), GTK_WIDGET(m_pSetScaleTable)); } m_pScaleObjectName = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "ScaleObjectName")); m_pXScaleEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "XScaleEntry")); m_pYScaleEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "YScaleEntry")); m_pZScaleEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "ZScaleEntry")); //set color connections //--------------------- m_pSetColorTable = GTK_TABLE(gtk_builder_get_object(m_pBuilderInterface, "SetColorTable")); //remove table from its parent gtk_object_ref(GTK_OBJECT(m_pSetColorTable)); l_pTableParent = gtk_widget_get_parent(GTK_WIDGET(m_pSetColorTable)); if(l_pTableParent != NULL && GTK_IS_CONTAINER(l_pTableParent)) { gtk_container_remove(GTK_CONTAINER(l_pTableParent), GTK_WIDGET(m_pSetColorTable)); } m_pColorObjectName = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "ColorObjectName")); m_pSetMaterialColorRadioButton = GTK_RADIO_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "SetMaterialColorRadioButton")); m_pRedEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "RedEntry")); m_pGreenEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "GreenEntry")); m_pBlueEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "BlueEntry")); m_pTransparencyEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilderInterface, "TransparencyEntry")); //REMOVE ME //GtkWidget* custom = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "customwidget")); /////////// }
static void gv_tool_real_activate(GvTool *tool, GvViewArea *view) { GvToolClass *klass; if (tool->view) { g_warning("gv_tool_activate(): tool %s is already active on a view", gtk_type_name(GTK_OBJECT_TYPE(tool))); return; } tool->view = view; gtk_object_ref(GTK_OBJECT(view)); klass = (GvToolClass*)gtk_type_class(GTK_OBJECT_TYPE(tool)); /* This could be done through an indirect function call which emits a tool signal. Probably better but more overhead... */ if (klass->draw) { gtk_signal_connect_object(GTK_OBJECT(view), "gldraw", GTK_SIGNAL_FUNC(klass->draw), GTK_OBJECT(tool)); } if (klass->button_press) { gtk_signal_connect_object(GTK_OBJECT(view), "button-press-event", GTK_SIGNAL_FUNC(klass->button_press), GTK_OBJECT(tool)); } if (klass->button_release) { gtk_signal_connect_object(GTK_OBJECT(view), "button-release-event", GTK_SIGNAL_FUNC(klass->button_release), GTK_OBJECT(tool)); } if (klass->motion_notify) { gtk_signal_connect_object(GTK_OBJECT(view), "motion-notify-event", GTK_SIGNAL_FUNC(klass->motion_notify), GTK_OBJECT(tool)); } if (klass->key_press) { gtk_signal_connect_object(GTK_OBJECT(view), "key-press-event", GTK_SIGNAL_FUNC(klass->key_press), GTK_OBJECT(tool)); } if (klass->enter_notify) { gtk_signal_connect_object(GTK_OBJECT(view), "enter-notify-event", GTK_SIGNAL_FUNC(klass->enter_notify), GTK_OBJECT(tool)); } if (klass->leave_notify) { gtk_signal_connect_object(GTK_OBJECT(view), "leave-notify-event", GTK_SIGNAL_FUNC(klass->leave_notify), GTK_OBJECT(tool)); } /* Install cursor for this tool */ if (GTK_WIDGET_REALIZED(GTK_WIDGET(view))) { gdk_window_set_cursor(GTK_WIDGET(view)->window, tool->cursor); } }
void on_button_clicked (GtkWidget *button, gpointer user_data) { int x_pos, y_pos; int current_pos; gchar file_name[MAXSIZE]; struct pos *temp_undo_store_positions; temp_undo_store_positions = (struct pos *)(malloc(sizeof(struct pos))); current_pos = (gint) gtk_object_get_data (GTK_OBJECT(button), "current_pos"); if ( is_legal_slide(current_pos, vacant_pos) ){ gtk_widget_set_sensitive(undo_button,TRUE); /* Activate undo button*/ max_undos_supported_count++; x_pos = vacant_pos%4; y_pos = (int)(vacant_pos/4); if(temp_undo_store_positions){ temp_undo_store_positions->attach_in_vac_pos = vacant_pos; temp_undo_store_positions->link = undo_store_positions; undo_store_positions = temp_undo_store_positions; }else{ g_print("unable to allocate memory from heap for undo strcut"); gtk_main_quit(); /* Quit application */ } no_of_valid_undos++; gtk_container_remove (GTK_CONTAINER(table1), button); gtk_table_attach (GTK_TABLE (table1), button, x_pos, x_pos + 1, y_pos, y_pos + 1, (GtkAttachOptions) GTK_FILL | GTK_EXPAND, (GtkAttachOptions) GTK_FILL | GTK_EXPAND, (GtkAttachOptions) 1, 1); gtk_object_set_data (GTK_OBJECT(button), "current_pos",(gpointer) vacant_pos); vacant_pos = current_pos; move_no++; if ( has_player_won() ) { gtk_statusbar_push (GTK_STATUSBAR(statusbar1), 0, g_strdup_printf("Eureka You Won the Game with in %i Moves", move_no)); gtk_widget_hide (table1); image = gtk_image_new (); sprintf(file_name,"%swon.png",IMAGES_DIR); gtk_image_set_from_file (GTK_IMAGE(image), file_name); gtk_object_ref(GTK_OBJECT(table1)); gtk_container_remove (GTK_CONTAINER(alignment1), table1); gtk_container_add (GTK_CONTAINER(alignment1), image); gtk_widget_show (image); }else gtk_statusbar_push (GTK_STATUSBAR(statusbar1), 0, g_strdup_printf("Move No.: %i", move_no)); } else gtk_statusbar_push (GTK_STATUSBAR(statusbar1), 0, "Wrong Move !"); if(max_undos_supported_count > NO_OF_UNDOS_SUPPORTED){ max_undos_supported_count=NO_OF_UNDOS_SUPPORTED; free_last_element_in_undo_stack(&undo_store_positions); } }
static GtkWidget *get_video_sliders_widget() { GtkWidget *hbox, *vbox, *pixmap, *scrollbar; GtkTooltips *tooltip; int i=0; char *titles[4] = { "Hue", "Contrast", "Brightness", "Colour Saturation" }; char *names[4] = { "hue", "contrast", "brightness", "colour" }; GtkAdjustment *adj[4] = { GTK_TVPLUG(tv)->hue_adj, GTK_TVPLUG(tv)->contrast_adj, GTK_TVPLUG(tv)->brightness_adj, GTK_TVPLUG(tv)->saturation_adj }; char **pixmaps[4] = { slider_hue_xpm, slider_contrast_xpm, slider_brightness_xpm, slider_sat_colour_xpm, }; tooltip = gtk_tooltips_new(); hbox = gtk_hbox_new(TRUE, 20); for (i=0;i<4;i++) { vbox = gtk_vbox_new (FALSE, 0); gtk_signal_connect(GTK_OBJECT(adj[i]), "value_changed", GTK_SIGNAL_FUNC(video_slider_changed), names[i]); gtk_object_ref(GTK_OBJECT(adj[i])); scrollbar = gtk_vscale_new(adj[i]); gtk_scale_set_draw_value(GTK_SCALE(scrollbar), 0); gtk_box_pack_start(GTK_BOX (vbox), scrollbar, TRUE, TRUE, 10); gtk_widget_show(scrollbar); gtk_widget_set_usize(scrollbar, -1, 150); gtk_tooltips_set_tip(tooltip, scrollbar, titles[i], NULL); pixmap = gtk_widget_from_xpm_data(pixmaps[i]); gtk_widget_show(pixmap); gtk_box_pack_start(GTK_BOX(vbox), pixmap, FALSE, FALSE, 10); gtk_box_pack_start(GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_widget_show(vbox); } #ifdef OSS /* Audio volume slider */ if (mixer_id > 0) { vbox = gtk_vbox_new (FALSE, 0); adj_audio = GTK_ADJUSTMENT(gtk_adjustment_new(100-volume,0,100,1,10,0)); gtk_signal_connect(GTK_OBJECT(adj_audio), "value_changed", GTK_SIGNAL_FUNC(audio_slider_changed), NULL); scrollbar = gtk_vscale_new(adj_audio); gtk_scale_set_draw_value(GTK_SCALE(scrollbar), 0); gtk_box_pack_start(GTK_BOX (vbox), scrollbar, TRUE, TRUE, 10); gtk_widget_show(scrollbar); gtk_widget_set_usize(scrollbar, -1, 150); gtk_tooltips_set_tip(tooltip, scrollbar, "Audio Volume", NULL); pixmap = gtk_widget_from_xpm_data(slider_volume_xpm); gtk_widget_show(pixmap); gtk_box_pack_start(GTK_BOX(vbox), pixmap, FALSE, FALSE, 10); gtk_box_pack_start(GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_widget_show(vbox); } #endif return hbox; }
void gtk_xpart_set_widget( GtkXPart *part, GtkWidget *widget ) { GtkXPartPrivate *d = (GtkXPartPrivate *)part->data; d->widget = widget; gtk_object_ref( GTK_OBJECT( widget ) ); }