/** * \brief snaps to the grid, updates the model if snapping was necessary * * \attention this will cause a loop cycle of "changed" signals * until no more snapping is necessary * * @param item_data * @param grid */ void item_data_snap (ItemData *item_data, Grid *grid) { gboolean handler_connected; g_return_if_fail (item_data); g_return_if_fail (IS_ITEM_DATA (item_data)); g_return_if_fail (grid); g_return_if_fail (IS_GRID (grid)); if (snap_to_grid (grid, &(item_data->priv->translate.x0), &(item_data->priv->translate.y0))) { #if 1 // TODO FIXME XXX rename this to "snapped" instead of moved handler_connected = g_signal_handler_is_connected (G_OBJECT (item_data), item_data->moved_handler_id); if (handler_connected) { g_signal_emit_by_name (G_OBJECT (item_data), "moved"); // FIXME replace this by a "snapped" signal } #endif handler_connected = g_signal_handler_is_connected (G_OBJECT (item_data), item_data->changed_handler_id); if (handler_connected) { g_signal_emit_by_name (G_OBJECT (item_data), "changed"); } } }
/* Triggers when a new active window is selected */ static void active_window_changed (WnckScreen *screen, WnckWindow *previous, WTApplet *wtapplet) { // Start tracking the new active window: if (wtapplet->activewindow) { if (g_signal_handler_is_connected(G_OBJECT(wtapplet->activewindow), wtapplet->active_handler_state)) g_signal_handler_disconnect(G_OBJECT(wtapplet->activewindow), wtapplet->active_handler_state); if (g_signal_handler_is_connected(G_OBJECT(wtapplet->activewindow), wtapplet->active_handler_name)) g_signal_handler_disconnect(G_OBJECT(wtapplet->activewindow), wtapplet->active_handler_name); if (g_signal_handler_is_connected(G_OBJECT(wtapplet->activewindow), wtapplet->active_handler_icon)) g_signal_handler_disconnect(G_OBJECT(wtapplet->activewindow), wtapplet->active_handler_icon); } wtapplet->activewindow = wnck_screen_get_active_window(screen); wtapplet->umaxedwindow = getUpperMaximized(wtapplet); // returns wbapplet->activewindow if not only_maximized wtapplet->rootwindow = getRootWindow(wtapplet->activescreen); if (wtapplet->activewindow) { wtapplet->active_handler_state = g_signal_connect(G_OBJECT (wtapplet->activewindow), "state-changed", G_CALLBACK (active_window_state_changed), wtapplet); wtapplet->active_handler_name = g_signal_connect(G_OBJECT (wtapplet->activewindow), "name-changed", G_CALLBACK (active_window_nameicon_changed), wtapplet); wtapplet->active_handler_icon = g_signal_connect(G_OBJECT (wtapplet->activewindow), "icon-changed", G_CALLBACK (active_window_nameicon_changed), wtapplet); wtapplet->focused = TRUE; updateTitle(wtapplet); } }
static void setup_signals (BroadbandDeviceInfo *info, gboolean enable) { if (enable) { g_assert (info->mm_modem_3gpp == NULL); g_assert (info->mm_modem_cdma == NULL); g_assert (info->operator_name_update_id == 0); g_assert (info->operator_code_update_id == 0); g_assert (info->sid_update_id == 0); info->mm_modem_3gpp = mm_object_get_modem_3gpp (info->mm_object); info->mm_modem_cdma = mm_object_get_modem_cdma (info->mm_object); if (info->mm_modem_3gpp) { info->operator_name_update_id = g_signal_connect (info->mm_modem_3gpp, "notify::operator-name", G_CALLBACK (operator_info_updated), info); info->operator_code_update_id = g_signal_connect (info->mm_modem_3gpp, "notify::operator-code", G_CALLBACK (operator_info_updated), info); } if (info->mm_modem_cdma) { info->sid_update_id = g_signal_connect (info->mm_modem_cdma, "notify::sid", G_CALLBACK (operator_info_updated), info); } /* Load initial values */ operator_info_updated (NULL, NULL, info); } else { if (info->mm_modem_3gpp) { if (info->operator_name_update_id) { if (g_signal_handler_is_connected (info->mm_modem_3gpp, info->operator_name_update_id)) g_signal_handler_disconnect (info->mm_modem_3gpp, info->operator_name_update_id); info->operator_name_update_id = 0; } if (info->operator_code_update_id) { if (g_signal_handler_is_connected (info->mm_modem_3gpp, info->operator_code_update_id)) g_signal_handler_disconnect (info->mm_modem_3gpp, info->operator_code_update_id); info->operator_code_update_id = 0; } g_clear_object (&info->mm_modem_3gpp); } if (info->mm_modem_cdma) { if (info->sid_update_id) { if (g_signal_handler_is_connected (info->mm_modem_cdma, info->sid_update_id)) g_signal_handler_disconnect (info->mm_modem_cdma, info->sid_update_id); info->sid_update_id = 0; } g_clear_object (&info->mm_modem_cdma); } } }
/* Returns the highest maximized window */ static WnckWindow *getUpperMaximized (WTApplet *wtapplet) { if (!wtapplet->prefs->only_maximized) return wtapplet->activewindow; GList *windows = wnck_screen_get_windows_stacked(wtapplet->activescreen); WnckWindow *returnwindow = NULL; while (windows && windows->data) { if (wnck_window_is_maximized(windows->data)) { // if(wnck_window_is_on_workspace(windows->data, wtapplet->activeworkspace)) if (!wnck_window_is_minimized(windows->data)) if (wnck_window_is_in_viewport(windows->data, wtapplet->activeworkspace)) returnwindow = windows->data; } windows = windows->next; } // start tracking the new umaxed window if (wtapplet->umaxedwindow) { if (g_signal_handler_is_connected(G_OBJECT(wtapplet->umaxedwindow), wtapplet->umaxed_handler_state)) g_signal_handler_disconnect(G_OBJECT(wtapplet->umaxedwindow), wtapplet->umaxed_handler_state); if (g_signal_handler_is_connected(G_OBJECT(wtapplet->umaxedwindow), wtapplet->umaxed_handler_name)) g_signal_handler_disconnect(G_OBJECT(wtapplet->umaxedwindow), wtapplet->umaxed_handler_name); if (g_signal_handler_is_connected(G_OBJECT(wtapplet->umaxedwindow), wtapplet->umaxed_handler_icon)) g_signal_handler_disconnect(G_OBJECT(wtapplet->umaxedwindow), wtapplet->umaxed_handler_icon); } if (returnwindow) { // maxed window was found wtapplet->umaxed_handler_state = g_signal_connect(G_OBJECT(returnwindow), "state-changed", G_CALLBACK (umaxed_window_state_changed), wtapplet); wtapplet->umaxed_handler_name = g_signal_connect(G_OBJECT(returnwindow), "name-changed", G_CALLBACK (umaxed_window_nameicon_changed), wtapplet); wtapplet->umaxed_handler_icon = g_signal_connect(G_OBJECT(returnwindow), "icon-changed", G_CALLBACK (umaxed_window_nameicon_changed), wtapplet); //return returnwindow; } else { // maxed window was not found returnwindow = wtapplet->rootwindow; //return wtapplet->rootwindow; } return returnwindow; // WARNING: if this function returns NULL, applet won't detect clicks! }
// Cancel the placement of floating items and remove them. void sheet_item_cancel_floating (Sheet *sheet) { GooCanvasGroup *group; GList *list; g_return_if_fail (sheet != NULL); g_return_if_fail (IS_SHEET (sheet)); group = GOO_CANVAS_GROUP (sheet->priv->floating_group); if (group == NULL) return; if (sheet->state != SHEET_STATE_FLOAT && sheet->state != SHEET_STATE_FLOAT_START) return; if (g_signal_handler_is_connected (sheet, sheet->priv->float_handler_id)) g_signal_handler_disconnect (sheet, sheet->priv->float_handler_id); // TODO verfiy that the following has no nasty sideffects for (list = sheet->priv->floating_objects; list; list = list->next) { goo_canvas_item_remove (list->data); // remove from canvas and free } g_list_free (sheet->priv->floating_objects); sheet->priv->floating_objects = NULL; goo_canvas_item_remove (GOO_CANVAS_ITEM (group)); // Create a new empty group to prepare next floating group sheet->priv->floating_group = GOO_CANVAS_GROUP ( goo_canvas_group_new (GOO_CANVAS_ITEM (sheet->object_group), "x", 0.0, "y", 0.0, NULL)); // sheet_clear_ghosts (sheet); sheet->priv->float_handler_id = 0; sheet->state = SHEET_STATE_NONE; }
static void _gtk_text_handle_set_parent (GtkTextHandle *handle, GtkWidget *parent) { GtkTextHandlePrivate *priv; GtkWidget *scrollable = NULL; priv = handle->priv; if (priv->parent == parent) return; if (priv->parent && priv->hierarchy_changed_id && g_signal_handler_is_connected (priv->parent, priv->hierarchy_changed_id)) g_signal_handler_disconnect (priv->parent, priv->hierarchy_changed_id); priv->parent = parent; if (parent) { priv->hierarchy_changed_id = g_signal_connect (parent, "hierarchy-changed", G_CALLBACK (_gtk_text_handle_parent_hierarchy_changed), handle); scrollable = gtk_text_handle_lookup_scrollable (handle); } _gtk_text_handle_update_scrollable (handle, GTK_SCROLLABLE (scrollable)); }
static void _gtk_text_handle_update_scrollable (GtkTextHandle *handle, GtkScrollable *scrollable) { GtkTextHandlePrivate *priv; priv = handle->priv; if (priv->parent_scrollable == scrollable) return; if (priv->parent_scrollable && priv->scrollable_notify_id && g_signal_handler_is_connected (priv->parent_scrollable, priv->scrollable_notify_id)) g_signal_handler_disconnect (priv->parent_scrollable, priv->scrollable_notify_id); _gtk_text_handle_set_scrollable (handle, scrollable); if (priv->parent_scrollable) priv->scrollable_notify_id = g_signal_connect (priv->parent_scrollable, "notify", G_CALLBACK (_gtk_text_handle_scrollable_notify), handle); }
static void gssdp_resource_browser_dispose (GObject *object) { GSSDPResourceBrowser *resource_browser; GSSDPResourceBrowserPrivate *priv; resource_browser = GSSDP_RESOURCE_BROWSER (object); priv = gssdp_resource_browser_get_instance_private (resource_browser); if (priv->client) { if (g_signal_handler_is_connected (priv->client, priv->message_received_id)) { g_signal_handler_disconnect (priv->client, priv->message_received_id); } stop_discovery (resource_browser); g_object_unref (priv->client); priv->client = NULL; } clear_cache (resource_browser); G_OBJECT_CLASS (gssdp_resource_browser_parent_class)->dispose (object); }
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); } }
AP_UnixLeftRuler::~AP_UnixLeftRuler(void) { GtkWidget * toplevel = static_cast<XAP_UnixFrameImpl *>(m_pFrame->getFrameImpl())->getTopLevelWindow(); if (toplevel && g_signal_handler_is_connected(G_OBJECT(toplevel), m_iBackgroundRedrawID)) { g_signal_handler_disconnect(G_OBJECT(toplevel),m_iBackgroundRedrawID); } DELETEP(m_pG); }
//----------------------------------------------------------------------------- void on_sensor_operations_dialog_close (GtkDialog *dialog, gpointer user_data) { // dziwne, ale kolejnosc chyba ma znaczenie... if (g_signal_handler_is_connected (G_OBJECT (sensor_operation_dialog_ok_button), signal_handler)) g_signal_handler_disconnect (G_OBJECT (sensor_operation_dialog_ok_button), signal_handler); gtk_widget_hide((GtkWidget*)sensor_operations_dialog) ; } ;
static void xid_callback_data_destroy_cb(gpointer data) { struct xid_callback_data *xid_cb_data = (struct xid_callback_data *)data; if (g_signal_handler_is_connected(xid_cb_data->bus, xid_cb_data->cb_id)) { g_signal_handler_disconnect (xid_cb_data->bus, xid_cb_data->cb_id); } g_slice_free(struct xid_callback_data, data); }
void fsif_exit(OhmPlugin *plugin) { (void)plugin; fs = ohm_fact_store_get_fact_store(); if (g_signal_handler_is_connected(G_OBJECT(fs), updated_id)) { g_signal_handler_disconnect(G_OBJECT(fs), updated_id); updated_id = 0; } if (g_signal_handler_is_connected(G_OBJECT(fs), inserted_id)) { g_signal_handler_disconnect(G_OBJECT(fs), inserted_id); inserted_id = 0; } if (g_signal_handler_is_connected(G_OBJECT(fs), removed_id)) { g_signal_handler_disconnect(G_OBJECT(fs), removed_id); removed_id = 0; } }
static void gssdp_resource_group_dispose (GObject *object) { GSSDPResourceGroup *resource_group; GSSDPResourceGroupPrivate *priv; resource_group = GSSDP_RESOURCE_GROUP (object); priv = resource_group->priv; while (priv->resources) { resource_free (priv->resources->data); priv->resources = g_list_delete_link (priv->resources, priv->resources); } if (priv->message_queue) { /* send messages without usual delay */ while (!g_queue_is_empty (priv->message_queue)) { if (priv->available) process_queue (resource_group); else g_free (g_queue_pop_head (priv->message_queue)); } g_queue_free (priv->message_queue); priv->message_queue = NULL; } if (priv->message_src) { g_source_destroy (priv->message_src); priv->message_src = NULL; } if (priv->timeout_src) { g_source_destroy (priv->timeout_src); priv->timeout_src = NULL; } if (priv->client) { if (g_signal_handler_is_connected (priv->client, priv->message_received_id)) { g_signal_handler_disconnect (priv->client, priv->message_received_id); } g_object_unref (priv->client); priv->client = NULL; } G_OBJECT_CLASS (gssdp_resource_group_parent_class)->dispose (object); }
//! //! @brief Used to remove a listener //! @param settings The GSettings object to act on You will have to get it yourself using lw_preferences_get_settings_object //! @param id The signalid returned by lw_preferences_add_change_listener //! void lw_preferences_remove_change_listener (GSettings *settings, gulong id) { if (g_signal_handler_is_connected (G_OBJECT (settings), id)) { g_signal_handler_disconnect (G_OBJECT (settings), id); } else { } }
static void caja_autorun_combobox_data_destroy (CajaAutorunComboBoxData *data) { /* signal handler may be automatically disconnected by destroying the widget */ if (g_signal_handler_is_connected (G_OBJECT (data->combo_box), data->changed_signal_id)) { g_signal_handler_disconnect (G_OBJECT (data->combo_box), data->changed_signal_id); } g_free (data->x_content_type); g_free (data); }
void test_clear (void) { gulong handler_id; GError *error = NULL; milter_assert_default_configuration(config); test_privilege_mode(); test_effective_user(); test_effective_group(); test_manager_unix_socket_group(); test_controller_unix_socket_group(); test_manager_connection_spec(); test_controller_connection_spec(); test_fallback_status(); test_children(); test_daemon(); test_maintenance_interval(); test_suspend_time_on_unacceptable(); test_max_connections(); test_max_file_descriptors(); test_event_loop_backend(); test_connection_check_interval(); test_n_workers(); test_default_packet_buffer_size(); test_use_syslog(); test_syslog_facility(); test_chunk_size(); test_max_pending_finished_sessions(); handler_id = g_signal_connect(config, "connected", G_CALLBACK(cb_connected), NULL); cut_assert_true(g_signal_handler_is_connected(config, handler_id)); milter_manager_configuration_clear(config, &error); gcut_assert_error(error); milter_assert_default_configuration(config); cut_assert_false(g_signal_handler_is_connected(config, handler_id)); }
gboolean wck_signal_handler_disconnect (GObject *object, gulong handler) { if (object && handler > 0) { if (g_signal_handler_is_connected(object, handler)) { g_signal_handler_disconnect(object, handler); return TRUE; } } return FALSE; }
static gpointer gw_installprogresswindow_install_thread (gpointer data) { //Declarations GwInstallProgressWindow *window; GwInstallProgressWindowPrivate *priv; GwApplication *application; GwDictionaryList *dictionarylist; GList *link; LwDictionary *dictionary; GError *error; gulong signalid; GCancellable *cancellable; //Initializations window = GW_INSTALLPROGRESSWINDOW (data); if (window == NULL) return NULL; priv = window->priv; application = gw_window_get_application (GW_WINDOW (window)); dictionarylist = gw_application_get_installable_dictionarylist (application); cancellable = priv->cancellable; error = NULL; link = lw_dictionarylist_get_list (LW_DICTIONARYLIST (dictionarylist)); //Do the installation g_timeout_add (100, gw_installprogresswindow_update_ui_timeout, window); while (link != NULL && error == NULL) { dictionary = LW_DICTIONARY (link->data); if (dictionary != NULL && lw_dictionary_is_selected (dictionary)) { g_mutex_lock (&priv->mutex); priv->dictionary = dictionary; g_mutex_unlock (&priv->mutex); signalid = g_signal_connect (dictionary, "progress-changed", G_CALLBACK (gw_installprogresswindow_update_dictionary_cb), window); lw_dictionary_install (dictionary, cancellable, &error); if (g_signal_handler_is_connected (dictionary, signalid)) g_signal_handler_disconnect (dictionary, signalid); } link = link->next; } gw_application_set_error (application, error); error = NULL; g_mutex_lock (&priv->mutex); //This will clue the progress window to close itself priv->dictionary = NULL; g_mutex_unlock (&priv->mutex); return NULL; }
bool NokiaMaemoLocationInterfaceImpl::stopTracking() { nav2log << "stopTracking : disconnecting from signal 'changed' with idd=" << m_idd_changed << endl; if (g_signal_handler_is_connected (m_device, m_idd_changed)) { g_signal_handler_disconnect(m_device, m_idd_changed); if (g_signal_handler_is_connected (m_device, m_idd_changed)) { nav2log << "stopTracking : disconnect from signal 'changed' with idd=" << m_idd_changed << " failed" << endl; return false; //could not disconnect from signal } // set the changed signal connect int back to initial value disconnected m_idd_changed = 0; } else { nav2log << "stopTracking : skipping signal 'changed' disconnect " << "since it's already disconnected" << endl; return true; } return true; }
void item_data_set_pos (ItemData *item_data, Coords *pos) { ItemDataPriv *priv; gboolean handler_connected; g_return_if_fail (pos); g_return_if_fail (item_data); g_return_if_fail (IS_ITEM_DATA (item_data)); priv = item_data->priv; cairo_matrix_init_translate (&(priv->translate), pos->x, pos->y); handler_connected = g_signal_handler_is_connected (G_OBJECT (item_data), item_data->moved_handler_id); if (handler_connected) { g_signal_emit_by_name (G_OBJECT (item_data), "moved", pos); } handler_connected = g_signal_handler_is_connected (G_OBJECT (item_data), item_data->changed_handler_id); if (handler_connected) { g_signal_emit_by_name (G_OBJECT (item_data), "changed"); } }
//! //! @brief Installs the named dictionary, deleting it. //! //! @param name A string of the name of the dictionary to install. //! gint w_console_install_dictionary (WApplication *application, GError **error) { //Sanity check if (error != NULL && *error != NULL) return 1; //Declarations LwDictionaryList *dictionarylist; LwDictionary *dictionary; gint resolution; gulong signalid; const gchar *install_switch_data; //Initializations install_switch_data = w_application_get_install_switch_data (application); dictionarylist = w_application_get_installable_dictionarylist (application); dictionary = lw_dictionarylist_get_dictionary_fuzzy (dictionarylist, install_switch_data); resolution = 0; if (dictionary != NULL) { printf(gettext("Installing %s Dictionary...\n"), lw_dictionary_get_name (dictionary)); signalid = g_signal_connect (G_OBJECT (dictionary), "progress-changed", G_CALLBACK (w_console_update_progress_cb), application); lw_dictionary_install (dictionary, NULL, error); if (g_signal_handler_is_connected (G_OBJECT (dictionary), signalid)) g_signal_handler_disconnect (G_OBJECT (dictionary), signalid); if (*error == NULL) { printf("\n%s\n", gettext("Installation complete.")); } else { printf ("\n%s\n", gettext("Installation failed!")); } } else { printf("\n%s was not found!\n\n", install_switch_data); w_console_print_installable_dictionaries (application); } if (*error != NULL) { resolution = 1; } return resolution; }
static void tray_provider_finalize (GObject *object) { TrayProvider *tray; tray = TRAY_PROVIDER (object); if ( GTK_IS_WIDGET (tray->window) && g_signal_handler_is_connected (tray->window, tray->sig) ) g_signal_handler_disconnect (tray->window, tray->sig); #ifdef HAVE_LIBNOTIFY close_notification (tray); #endif g_object_unref (G_OBJECT (tray->tray)); G_OBJECT_CLASS (tray_provider_parent_class)->finalize (object); }
/** * champlain_map_source_chain_push: * @source_chain: a #ChamplainMapSourceChain * @map_source: the #ChamplainMapSource to be pushed into the chain * * Pushes a map source into the chain. * * Since: 0.6 */ void champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain, ChamplainMapSource *map_source) { ChamplainMapSourceChainPrivate *priv = source_chain->priv; gboolean is_cache = FALSE; if (CHAMPLAIN_IS_TILE_CACHE(map_source)) is_cache = TRUE; else g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE(map_source)); g_object_ref_sink (map_source); if (!priv->stack_top) { ChamplainMapSource *chain_next_source = champlain_map_source_get_next_source (CHAMPLAIN_MAP_SOURCE(source_chain)); /* tile source has to be last */ g_return_if_fail (!is_cache); priv->stack_top = map_source; priv->stack_bottom = map_source; if (chain_next_source) champlain_map_source_set_next_source (priv->stack_bottom, chain_next_source); } else { if (g_signal_handler_is_connected (priv->stack_top, priv->sig_handler_id)) g_signal_handler_disconnect (priv->stack_top, priv->sig_handler_id); champlain_map_source_set_next_source (map_source, priv->stack_top); priv->stack_top = map_source; if (is_cache) { ChamplainTileCache *tile_cache = CHAMPLAIN_TILE_CACHE(map_source); assign_cache_of_next_source_sequence (source_chain, priv->stack_top, tile_cache); } } priv->sig_handler_id = g_signal_connect (priv->stack_top, "reload-tiles", G_CALLBACK (reload_tiles_cb), source_chain); }
static void gssdp_resource_group_dispose (GObject *object) { GSSDPResourceGroup *resource_group; GSSDPResourceGroupPrivate *priv; resource_group = GSSDP_RESOURCE_GROUP (object); priv = gssdp_resource_group_get_instance_private (resource_group); g_list_free_full (priv->resources, (GFreeFunc) resource_free); priv->resources = NULL; if (priv->message_queue) { /* send messages without usual delay */ while (!g_queue_is_empty (priv->message_queue)) { if (priv->available) process_queue (resource_group); else g_free (g_queue_pop_head (priv->message_queue)); } g_clear_pointer (&priv->message_queue, g_queue_free); } /* No need to unref sources, already done on creation */ g_clear_pointer (&priv->message_src, g_source_destroy); g_clear_pointer (&priv->timeout_src, g_source_destroy); if (priv->client) { if (g_signal_handler_is_connected (priv->client, priv->message_received_id)) { g_signal_handler_disconnect (priv->client, priv->message_received_id); } g_clear_object (&priv->client); } G_OBJECT_CLASS (gssdp_resource_group_parent_class)->dispose (object); }
static void writeback_dispatcher_finalize (GObject *object) { TrackerWritebackDispatcherPrivate *priv = TRACKER_WRITEBACK_DISPATCHER_GET_PRIVATE (object); if (priv->signal_id != 0 && g_signal_handler_is_connected (object, priv->signal_id)) { g_signal_handler_disconnect (object, priv->signal_id); } if (priv->connection) { g_object_unref (priv->connection); } if (priv->d_connection) { g_object_unref (priv->d_connection); } if (priv->files_miner) { g_object_unref (priv->files_miner); } }
/** * champlain_map_source_chain_pop: * @source_chain: a #ChamplainMapSourceChain * * Pops the map source from the top of the stack from the chain. * * Since: 0.6 */ void champlain_map_source_chain_pop (ChamplainMapSourceChain *source_chain) { ChamplainMapSourceChainPrivate *priv = source_chain->priv; ChamplainMapSource *old_stack_top = priv->stack_top; ChamplainMapSource *next_source = champlain_map_source_get_next_source (priv->stack_top); g_return_if_fail (priv->stack_top); if (g_signal_handler_is_connected (priv->stack_top, priv->sig_handler_id)) g_signal_handler_disconnect (priv->stack_top, priv->sig_handler_id); if (CHAMPLAIN_IS_TILE_CACHE(priv->stack_top)) { ChamplainTileCache *tile_cache = NULL; if (CHAMPLAIN_IS_TILE_CACHE(next_source)) tile_cache = CHAMPLAIN_TILE_CACHE(next_source); /* _push() guarantees that the last source is tile_source so we can be sure that the next map source is still within the chain */ assign_cache_of_next_source_sequence (source_chain, priv->stack_top, tile_cache); } if (next_source == champlain_map_source_get_next_source (CHAMPLAIN_MAP_SOURCE(source_chain))) { priv->stack_top = NULL; priv->stack_bottom = NULL; } else priv->stack_top = next_source; if (priv->stack_top) { priv->sig_handler_id = g_signal_connect (priv->stack_top, "reload-tiles", G_CALLBACK (reload_tiles_cb), source_chain); } g_object_unref (old_stack_top); }
static void egg_toolbar_editor_disconnect_model (EggToolbarEditor *t) { EggToolbarEditorPrivate *priv = t->priv; EggToolbarsModel *model = priv->model; gulong handler; int i; for (i = 0; i < SIGNAL_HANDLER_LIST_SIZE; i++) { handler = priv->sig_handlers[i]; if (handler != 0) { if (g_signal_handler_is_connected (model, handler)) { g_signal_handler_disconnect (model, handler); } priv->sig_handlers[i] = 0; } } }
static void wibuti_watcher_find_window(WibutiWatcher *self) { WnckWorkspace *activeworkspace = wnck_screen_get_active_workspace(self->screen); WnckWindow *new_active = wnck_screen_get_active_window(self->screen); WnckWindow *new_tracked = NULL; // stop tracking the old active window if (G_IS_OBJECT(self->active)) { if (g_signal_handler_is_connected(G_OBJECT(self->active), self->handler_active_state_changed)) { g_signal_handler_disconnect(G_OBJECT(self->active), self->handler_active_state_changed); } } if (self->only_maximized) { // find upper maximized window GList *windows = wnck_screen_get_windows_stacked(self->screen); while (windows && windows->data) { if (!self->only_maximized || wnck_window_is_maximized(windows->data)) if (!wnck_window_is_minimized(windows->data) && !wnck_window_is_skip_pager(windows->data)) if (wnck_window_is_in_viewport(windows->data, activeworkspace)) new_tracked = windows->data; windows = windows->next; } // start tracking the new active window if (new_active) { self->handler_active_state_changed = g_signal_connect(G_OBJECT(new_active), "state-changed", G_CALLBACK(wibuti_watcher_window_state_changed_cb), self); } } else { new_tracked = new_active; } // stop tracking the old window if (G_IS_OBJECT(self->tracked)) { #ifdef WIBUTI_WITH_TITLE if (g_signal_handler_is_connected(G_OBJECT(self->tracked), self->handler_name_changed)) { g_signal_handler_disconnect(G_OBJECT(self->tracked), self->handler_name_changed); } if (g_signal_handler_is_connected(G_OBJECT(self->tracked), self->handler_icon_changed)) { g_signal_handler_disconnect(G_OBJECT(self->tracked), self->handler_icon_changed); } #endif // WIBUTI_WITH_TITLE if (g_signal_handler_is_connected(G_OBJECT(self->tracked), self->handler_tracked_state_changed)) { g_signal_handler_disconnect(G_OBJECT(self->tracked), self->handler_tracked_state_changed); } } // start tracking the new window if (new_tracked) { #ifdef WIBUTI_WITH_TITLE self->handler_name_changed = g_signal_connect(G_OBJECT(new_tracked), "name-changed", G_CALLBACK(wibuti_watcher_name_changed_cb), self); self->handler_icon_changed = g_signal_connect(G_OBJECT(new_tracked), "icon-changed", G_CALLBACK(wibuti_watcher_icon_changed_cb), self); #endif // WIBUTI_WITH_TITLE self->handler_tracked_state_changed = g_signal_connect(G_OBJECT(new_tracked), "state-changed", G_CALLBACK(wibuti_watcher_window_state_changed_cb), self); } self->tracked = new_tracked; self->active = new_active; }
/** * flip a part in a given direction * @direction gives the direction the item will be flipped, end users pov! * @center the center to flip over - currently ignored FIXME */ static void part_flip (ItemData *data, IDFlip direction, Coords *center) { Part *part; PartPriv *priv; int i; cairo_matrix_t affine; double x, y; double scale_v, scale_h; gboolean handler_connected; Coords pos, trans; Coords b1, b2; Coords pos_new, pos_old, delta; //FIXME properly recenter after flipping //Coords part_center_before, part_center_after, delta; g_return_if_fail (data); g_return_if_fail (IS_PART (data)); part = PART (data); priv = part->priv; item_data_get_pos (data, &trans); // mask, just for the sake of cleanness direction &= ID_FLIP_MASK; // TODO evaluate if we really want to be able to do double flips (180* rots via flipping) g_assert (direction != ID_FLIP_MASK); // create a transformation _relativ_ to the current _state_ // reverse axis and fix the created offset by adding 2*pos.x or .y // convert the flip direction to binary, used in the matrix setup // keep in mind that we do relativ manipulations within the model // which in turn makes this valid for all rotations! scale_h = ((direction & ID_FLIP_HORIZ) != 0) ? -1. : 1.; scale_v = ((direction & ID_FLIP_VERT) != 0) ? -1. : 1.; // magic, if we are in either 270 or 90 state, we need to rotate the flip state by 90° to draw it properly // TODO maybe better put this into the rotation function if ((priv->rotation / 90) % 2 == 1) { priv->flip ^= ID_FLIP_MASK; } // toggle the direction priv->flip ^= direction; if ((priv->flip & ID_FLIP_MASK)== ID_FLIP_MASK) { priv->flip = ID_FLIP_NONE; priv->rotation += 180; priv->rotation %= 360; } cairo_matrix_init_scale (&affine, scale_h, scale_v); item_data_get_pos (data, &pos_old); pos_new = pos_old; cairo_matrix_transform_point (&affine, &pos_new.x, &pos_new.y); g_printf ("\ncenter %p [old] x=%lf,y=%lf -->", data, pos_old.x, pos_old.y); g_printf (" x=%lf, y=%lf\n", pos_new.x, pos_new.y); delta.x = - pos_new.x + pos_old.x; delta.y = - pos_new.y + pos_old.y; // flip the pins for (i = 0; i < priv->num_pins; i++) { x = priv->pins[i].offset.x; y = priv->pins[i].offset.y; cairo_matrix_transform_point (&affine, &x, &y); if (fabs (x) < 1e-2) x = 0.0; if (fabs (y) < 1e-2) y = 0.0; priv->pins[i].offset.x = x; priv->pins[i].offset.y = y; } item_data_snap (data); // tell the view handler_connected = g_signal_handler_is_connected (G_OBJECT (part), ITEM_DATA(part)->flipped_handler_id); if (handler_connected) { g_signal_emit_by_name (G_OBJECT (part), "flipped", priv->flip); // TODO - proper boundingbox center calculation item_data_get_relative_bbox (ITEM_DATA (part), &b1, &b2); // flip the bounding box. cairo_matrix_transform_point (&affine, &b1.x, &b1.y); cairo_matrix_transform_point (&affine, &b2.x, &b2.y); item_data_set_relative_bbox (ITEM_DATA (part), &b1, &b2); item_data_set_pos (ITEM_DATA (part), &pos); // FIXME - proper recenter to boundingbox center } if (g_signal_handler_is_connected (G_OBJECT (part), ITEM_DATA (part)->changed_handler_id)) { g_signal_emit_by_name (G_OBJECT (part), "changed"); } }