Esempio n. 1
0
void li_value_free(liValue* val) {
	if (NULL == val) return;
	li_value_clear(val);
	g_slice_free(liValue, val);
}
static gboolean
account_status_changed_idle_cb (ChangedSignalData *signal_data)
{
  McAccount *account;
  AccountData *data;
  McPresence presence, old_p;
  TpConnectionStatus status, old_s;
  gboolean emit_presence = FALSE, emit_connection = FALSE;
  EmpathyAccountManager *manager = signal_data->manager;
  EmpathyAccountManagerPriv *priv = GET_PRIV (manager);

  presence = signal_data->presence;
  status = signal_data->status;
  account = mc_account_lookup (signal_data->unique_name);

  if (account)
    {
      data = g_hash_table_lookup (priv->accounts, account);
      g_assert (data);

      old_p = data->presence;
      old_s = data->status;

      if (old_p != presence)
        {
          data->presence = presence;
          emit_presence = TRUE;
        }

      if (old_s != status)
        {
          data->status = status;
          update_connection_numbers (manager, status, old_s);

          if (status == TP_CONNECTION_STATUS_CONNECTED)
            {
                if (data->source_id > 0) {
                  g_source_remove (data->source_id);
                  data->source_id = 0;
                }

                data->source_id = g_timeout_add_seconds (10,
                                                         remove_data_timeout,
                                                         data);
            }
          emit_connection = TRUE;
        }

      if (emit_presence)
        g_signal_emit (manager, signals[ACCOUNT_PRESENCE_CHANGED], 0,
                       account, presence, old_p);

      if (emit_connection)
        g_signal_emit (manager, signals[ACCOUNT_CONNECTION_CHANGED], 0,
                       account, signal_data->reason, status, old_s);

      g_object_unref (account);
    }

  g_object_unref (signal_data->manager);
  g_free (signal_data->unique_name);
  g_slice_free (ChangedSignalData, signal_data);

  return FALSE;
}
Esempio n. 3
0
/**
 * gst_segment_free:
 * @segment: (in) (transfer full): a #GstSegment
 *
 * Free the allocated segment @segment.
 */
void
gst_segment_free (GstSegment * segment)
{
  g_slice_free (GstSegment, segment);
}
Esempio n. 4
0
KARROT_EXPORT void
k_driver_free(KDriver *driver)
{
	g_slice_free(Driver, (Driver*) driver);
}
Esempio n. 5
0
static void
gst_index_group_free (GstIndexGroup * group)
{
  g_slice_free (GstIndexGroup, group);
}
static void
free_queued_message (QueuedMessage *message)
{
        g_free (message->text);
        g_slice_free (QueuedMessage, message);
}
Esempio n. 7
0
static void
free_auth_data(LuakitAuthData *auth_data)
{
    g_object_unref(auth_data->msg);
    g_slice_free(LuakitAuthData, auth_data);
}
Esempio n. 8
0
static void _http_header_free(gpointer p) {
	liHttpHeader *h = (liHttpHeader*) p;
	g_string_free(h->data, TRUE);
	g_slice_free(liHttpHeader, h);
}
Esempio n. 9
0
void li_http_headers_free(liHttpHeaders* headers) {
	if (!headers) return;
	g_queue_foreach(&headers->entries, _header_queue_free, NULL);
	g_queue_clear(&headers->entries);
	g_slice_free(liHttpHeaders, headers);
}
Esempio n. 10
0
void stream_driver(gboolean verbose, gint nthreads, 
                   FILE* infd, FILE* outfd) {
  gulong bufz = 0, pushed = 0, alloced=0;
  off_t partNum = 0, currPart = 0, totalBytes;
  PART_LIST_LOCK = g_mutex_new();
  file_part_t *part = NULL;
  GThreadPool *tp = NULL;
  
  tp = g_thread_pool_new(stream_read_func, NULL, nthreads, TRUE, NULL);
  
  
  
  while (!feof(infd) && !_recieved_SIGINT) {
    /* limit the number of jobs pushed to the thread pool a resonable number
       since the reader is going to be much faster then the other threads 
       anyway.
    */
    if (pushed < nthreads * 2) {
      part = g_slice_new(file_part_t);
      alloced++;
      /* read data from standard in into chunks */
      bufz = fread(part->inBuf, 1, READBUFZ, infd);
      part->inBufz = bufz;
      part->partNumber = partNum;
      partNum++;
      part->outBufz = WRITEBUFZ;
      part->error = FALSE;
      
      /* push file_parts into the thread pool for compression */
      g_thread_pool_push(tp, part, NULL);
      pushed++;
    }
    part = NULL;
    
    g_thread_yield();

    /* pop parts off of the output queue and write them to the out file */
    g_mutex_lock(PART_LIST_LOCK);
    if (PART_LIST != NULL) {
      part = (file_part_t*) PART_LIST->data;
      if (part->error == FALSE) {
        if (part->partNumber == currPart) {
          /* remove the head */
          PART_LIST = g_slist_delete_link(PART_LIST, PART_LIST);
          PART_LIST_SIZE--;
          currPart++; /* now look for the next part */
          pushed--;
        } else {
          /* the next part is still being processed so I'll try again later */
          part = NULL;
        }
      } else {
        /* Error */
        fprintf(stderr, "Error Occured while compressing data\n");
        exit(1);
      }
    }
    if (verbose) {
      fprintf(stderr, "\rPartNum: %4lld, CurrNum: %4lld, QueueSize: %4lld, Pushed: %4ld, Alloced Parts: %4ld",
              partNum, currPart, PART_LIST_SIZE, pushed, alloced);
      fflush(stderr);
    }
    g_mutex_unlock(PART_LIST_LOCK);

    if (part) {
      bufz = fwrite(part->outBuf, 1, part->outBufz, outfd);
      if (bufz != part->outBufz) {
        /* Error */
        fprintf(stderr, "Tried to write %ld bytes to but only wrote %ld\n",
                part->outBufz, bufz);
        perror("Error: ");
        exit(1);
      }
      totalBytes+=bufz;
      g_slice_free(file_part_t, part);
      alloced--;
      part = NULL;
    }
  }

  /* Wait for the thread pool to finish */
  g_thread_pool_free(tp, FALSE, TRUE);

  /* drain the rest of the queue */
  while (PART_LIST != NULL) {
    part = (file_part_t*) PART_LIST->data;
    if (part->error == FALSE) {
      if (part->partNumber == currPart) {
        /* remove the head */
        PART_LIST = g_slist_delete_link(PART_LIST, PART_LIST);
        pushed--;
        PART_LIST_SIZE--;
        currPart++; /* now look for the next part */
        bufz = fwrite(part->outBuf, 1, part->outBufz, outfd);
        if (bufz != part->outBufz) {
          /* Error */
          fprintf(stderr, "Tried to write %ld bytes to but only wrote %ld\n",
                  part->outBufz, bufz);
          perror("Error:");
          exit(1);
        }
        totalBytes+=bufz;
        g_slice_free(file_part_t, part);
        alloced--;
      } else {
        fprintf(stderr, "Error Parts out of order! I got part %lld but I was looking for part %lld\n", part->partNumber, currPart);
        exit(1);
      }
    } else {
      /* Error */
      fprintf(stderr, "Error Occured while compressing data\n");
      exit(1);
    }
    
    if (verbose) {
      fprintf(stderr, "\rPartNum: %4lld, CurrNum: %4lld, QueueSize: %4lld, Pushed: %4ld, Alloced Parts: %4ld",
              partNum, currPart, PART_LIST_SIZE, pushed, alloced);
      fflush(stderr);
    }
  }

  if (verbose) {
    fprintf(stderr, "\n");
  }

  g_mutex_free(PART_LIST_LOCK);
}
Esempio n. 11
0
static void
_rut_light_free (void *object)
{
  RutLight *light = object;
  g_slice_free (RutLight, light);
}
Esempio n. 12
0
static void
buffer_identification_free (BufferIdentification * id)
{
  g_slice_free (BufferIdentification, id);
}
Esempio n. 13
0
static void
_cogl_indices_free (CoglIndices *indices)
{
  cogl_object_unref (indices->buffer);
  g_slice_free (CoglIndices, indices);
}
static void
splitmux_part_free_queue_item (GstDataQueueItem * item)
{
  gst_mini_object_unref (item->object);
  g_slice_free (GstDataQueueItem, item);
}
Esempio n. 15
0
static void
remb_hash_value_destroy (gpointer value)
{
  g_slice_free (RembHashValue, value);
}
Esempio n. 16
0
static void free_func(gpointer o)
{
    g_slice_free(Options, o);
}
Esempio n. 17
0
void
component_free (Component *cmp)
{
  GSList *i;
  GList *item;

  for (i = cmp->local_candidates; i; i = i->next) {
    NiceCandidate *candidate = i->data;
    nice_candidate_free (candidate);
  }

  for (i = cmp->remote_candidates; i; i = i->next) {
    NiceCandidate *candidate = i->data;
    nice_candidate_free (candidate);
  }

  if (cmp->restart_candidate)
    nice_candidate_free (cmp->restart_candidate),
      cmp->restart_candidate = NULL;

  for (i = cmp->sockets; i; i = i->next) {
    NiceSocket *udpsocket = i->data;
    nice_socket_free (udpsocket);
  }

  for (i = cmp->gsources; i; i = i->next) {
    GSource *source = i->data;
    g_source_destroy (source);
    g_source_unref (source);
  }
 
  for (i = cmp->incoming_checks; i; i = i->next) {
    IncomingCheck *icheck = i->data;
    g_free (icheck->username);
    g_slice_free (IncomingCheck, icheck);
  }

  g_slist_free (cmp->local_candidates);
  g_slist_free (cmp->remote_candidates);
  g_slist_free (cmp->sockets);
  g_slist_free (cmp->gsources);
  g_slist_free (cmp->incoming_checks);

  for (item = cmp->turn_servers; item; item = g_list_next (item)) {
    TurnServer *turn = item->data;
    g_free (turn->username);
    g_free (turn->password);
    g_slice_free (TurnServer, turn);
  }
  g_list_free (cmp->turn_servers);

  if (cmp->selected_pair.keepalive.tick_source != NULL) {
    g_source_destroy (cmp->selected_pair.keepalive.tick_source);
    g_source_unref (cmp->selected_pair.keepalive.tick_source);
    cmp->selected_pair.keepalive.tick_source = NULL;
  }

  if (cmp->tcp_clock) {
    g_source_destroy (cmp->tcp_clock);
    g_source_unref (cmp->tcp_clock);
    cmp->tcp_clock = NULL;
  }
  if (cmp->tcp) {
    pseudo_tcp_socket_close (cmp->tcp, TRUE);
    g_object_unref (cmp->tcp);
    cmp->tcp = NULL;
  }
  if (cmp->tcp_data != NULL) {
    g_slice_free (TcpUserData, cmp->tcp_data);
    cmp->tcp_data = NULL;
  }

  if (cmp->ctx != NULL) {
    g_main_context_unref (cmp->ctx);
    cmp->ctx = NULL;
  }

  g_slice_free (Component, cmp);
}
Esempio n. 18
0
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
    Options *o = options;

    if (data->client) {
        Rect *area, *carea;
        ObClient *c;
        guint mon, cmon;
        gint x, y, lw, lh, w, h;

        c = data->client;
        mon = o->monitor;
        cmon = client_monitor(c);
        switch (mon) {
        case CURRENT_MONITOR:
            mon = cmon; break;
        case ALL_MONITORS:
            mon = SCREEN_AREA_ALL_MONITORS; break;
        case NEXT_MONITOR:
            mon = (cmon + 1 > screen_num_monitors - 1) ? 0 : (cmon + 1); break;
        case PREV_MONITOR:
            mon = (cmon == 0) ? (screen_num_monitors - 1) : (cmon - 1); break;
        default:
            g_assert_not_reached();
        }

        area = screen_area(c->desktop, mon, NULL);
        carea = screen_area(c->desktop, cmon, NULL);

        w = o->w;
        if (w == G_MININT) w = c->area.width;
        else if (o->w_denom) w = (w * area->width) / o->w_denom;

        h = o->h;
        if (h == G_MININT) h = c->area.height;
        else if (o->h_denom) h = (h * area->height) / o->h_denom;

        /* it might not be able to resize how they requested, so find out what
           it will actually be resized to */
        x = c->area.x;
        y = c->area.y;
        client_try_configure(c, &x, &y, &w, &h, &lw, &lh, TRUE);

        /* get the frame's size */
        w += c->frame->size.left + c->frame->size.right;
        h += c->frame->size.top + c->frame->size.bottom;

        x = o->x.pos;
        if (o->x.denom)
            x = (x * area->width) / o->x.denom;
        if (o->x.center) x = (area->width - w) / 2;
        else if (x == G_MININT) x = c->frame->area.x - carea->x;
        else if (o->x.opposite) x = area->width - w - x;
        x += area->x;

        y = o->y.pos;
        if (o->y.denom)
            y = (y * area->height) / o->y.denom;
        if (o->y.center) y = (area->height - h) / 2;
        else if (y == G_MININT) y = c->frame->area.y - carea->y;
        else if (o->y.opposite) y = area->height - h - y;
        y += area->y;

        /* get the client's size back */
        w -= c->frame->size.left + c->frame->size.right;
        h -= c->frame->size.top + c->frame->size.bottom;

        frame_frame_gravity(c->frame, &x, &y); /* get the client coords */
        client_try_configure(c, &x, &y, &w, &h, &lw, &lh, TRUE);
        /* force it on screen if its moving to another monitor */
        client_find_onscreen(c, &x, &y, w, h, mon != cmon);

        actions_client_move(data, TRUE);
        client_configure(c, x, y, w, h, TRUE, TRUE, FALSE);
        actions_client_move(data, FALSE);

        g_slice_free(Rect, area);
        g_slice_free(Rect, carea);
    }

    return FALSE;
}
Esempio n. 19
0
static gboolean
gimp_display_shell_autoscroll_timeout (gpointer data)
{
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
  ScrollInfo       *info  = shell->scroll_info;
  GimpCoords        device_coords;
  GimpCoords        image_coords;
  gint              dx = 0;
  gint              dy = 0;

  gimp_device_info_get_device_coords (info->device,
                                      gtk_widget_get_window (shell->canvas),
                                      &device_coords);

  if (device_coords.x < 0)
    dx = device_coords.x;
  else if (device_coords.x > shell->disp_width)
    dx = device_coords.x - shell->disp_width;

  if (device_coords.y < 0)
    dy = device_coords.y;
  else if (device_coords.y > shell->disp_height)
    dy = device_coords.y - shell->disp_height;

  if (dx || dy)
    {
      GimpDisplay *display         = shell->display;
      GimpTool    *active_tool     = tool_manager_get_active (display->gimp);
      gint         scroll_amount_x = AUTOSCROLL_DX * dx;
      gint         scroll_amount_y = AUTOSCROLL_DX * dy;

      info->time += AUTOSCROLL_DT;

      gimp_display_shell_scroll_unoverscrollify (shell,
                                                 scroll_amount_x,
                                                 scroll_amount_y,
                                                 &scroll_amount_x,
                                                 &scroll_amount_y);

      gimp_display_shell_scroll (shell,
                                 scroll_amount_x,
                                 scroll_amount_y);

      gimp_display_shell_untransform_coords (shell,
                                             &device_coords,
                                             &image_coords);

      if (gimp_tool_control_get_snap_to (active_tool->control))
        {
          gint x, y, width, height;

          gimp_tool_control_get_snap_offsets (active_tool->control,
                                              &x, &y, &width, &height);

          gimp_display_shell_snap_coords (shell,
                                          &image_coords,
                                          x, y, width, height);
        }

      tool_manager_motion_active (display->gimp,
                                  &image_coords,
                                  info->time, info->state,
                                  display);

      return TRUE;
    }
  else
    {
      g_slice_free (ScrollInfo, info);
      shell->scroll_info = NULL;

      return FALSE;
    }
}
Esempio n. 20
0
static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         GeglBuffer          *output,
         const GeglRectangle *roi,
         gint                 level)
{
  GeglProperties *o = GEGL_PROPERTIES (operation);

  gdouble         percentile           = o->percentile       / 100.0;
  gdouble         alpha_percentile     = o->alpha_percentile / 100.0;
  const gint     *neighborhood_outline = o->user_data;

  const Babl     *format               = gegl_operation_get_format (operation, "input");
  gint            n_components         = babl_format_get_n_components (format);
  gboolean        has_alpha            = babl_format_has_alpha (format);

  G_STATIC_ASSERT (sizeof (gint32) == sizeof (gfloat));
  gint32         *src_buf;
  gfloat         *dst_buf;
  GeglRectangle   src_rect;
  gint            src_stride;
  gint            dst_stride;
  gint            n_pixels;

  Histogram      *hist;

  const gint32   *src;
  gfloat         *dst;
  gint            dst_x, dst_y;
  Direction       dir;

  gint            i;
  gint            c;

  src_rect   = gegl_operation_get_required_for_output (operation, "input", roi);
  src_stride = src_rect.width * n_components;
  dst_stride = roi->width * n_components;
  n_pixels   = roi->width * roi->height;
  dst_buf = g_new0 (gfloat, n_pixels                         * n_components);
  src_buf = g_new0 (gint32, src_rect.width * src_rect.height * n_components);

  gegl_buffer_get (input, &src_rect, 1.0, format, src_buf,
                   GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_CLAMP);
  convert_values_to_bins (src_buf, n_components, has_alpha,
                          src_rect.width * src_rect.height);

  hist = g_slice_new0 (Histogram);

  src = src_buf + o->radius * (src_rect.width + 1) * n_components;
  dst = dst_buf;

  /* compute the first window */

  for (i = -o->radius; i <= o->radius; i++)
    {
      histogram_modify_vals (hist, src, n_components, src_stride, has_alpha,
                             i, -neighborhood_outline[abs (i)],
                             i, +neighborhood_outline[abs (i)],
                             +1);

      hist->size += 2 * neighborhood_outline[abs (i)] + 1;
    }

  for (c = 0; c < 3; c++)
    dst[c] = histogram_get_median (hist, c, percentile);

  if (has_alpha)
    dst[3] = histogram_get_median (hist, 3, alpha_percentile);

  dst_x = 0;
  dst_y = 0;

  n_pixels--;
  dir = LEFT_TO_RIGHT;

  while (n_pixels--)
    {
      /* move the src coords based on current direction and positions */
      if (dir == LEFT_TO_RIGHT)
        {
          if (dst_x != roi->width - 1)
            {
              dst_x++;
              src += n_components;
              dst += n_components;
            }
          else
            {
              dst_y++;
              src += src_stride;
              dst += dst_stride;
              dir = TOP_TO_BOTTOM;
            }
        }
      else if (dir == TOP_TO_BOTTOM)
        {
          if (dst_x == 0)
            {
              dst_x++;
              src += n_components;
              dst += n_components;
              dir = LEFT_TO_RIGHT;
            }
          else
            {
              dst_x--;
              src -= n_components;
              dst -= n_components;
              dir = RIGHT_TO_LEFT;
            }
        }
      else if (dir == RIGHT_TO_LEFT)
        {
          if (dst_x != 0)
            {
              dst_x--;
              src -= n_components;
              dst -= n_components;
            }
          else
            {
              dst_y++;
              src += src_stride;
              dst += dst_stride;
              dir = TOP_TO_BOTTOM;
            }
        }

      histogram_update (hist, src, n_components, src_stride, has_alpha,
                        o->neighborhood, o->radius, neighborhood_outline,
                        dir);

      for (c = 0; c < 3; c++)
        dst[c] = histogram_get_median (hist, c, percentile);

      if (has_alpha)
        dst[3] = histogram_get_median (hist, 3, alpha_percentile);
    }

  gegl_buffer_set (output, roi, 0, format, dst_buf, GEGL_AUTO_ROWSTRIDE);

  g_slice_free (Histogram, hist);
  g_free (dst_buf);
  g_free (src_buf);

  return TRUE;
}
Esempio n. 21
0
static void
gtk_css_value_enum_free (GtkCssValue *value)
{
  g_slice_free (GtkCssValue, value);
}
Esempio n. 22
0
void
on_dlg_response ( GtkDialog *dialog,
                                gint response_id,
                                gpointer user_data )
{
    FilePropertiesDialogData * data;
    PtkFileTask* task;
    gboolean mod_change;
    uid_t uid = -1;
    gid_t gid = -1;
    const char* owner_name;
    const char* group_name;
    int i;
    GList* l;
    GList* file_list;
    char* file_path;
    GtkWidget* ask_recursive;
    VFSFileInfo* file;
    GtkAllocation allocation;

    gtk_widget_get_allocation ( GTK_WIDGET( dialog ), &allocation );
    
    int width = allocation.width;
    int height = allocation.height;
    if ( width && height )
    {
        char* str = g_strdup_printf( "%d", width );
        xset_set( "app_dlg", "s", str );
        g_free( str );
        str = g_strdup_printf( "%d", height );
        xset_set( "app_dlg", "z", str );
        g_free( str );
    }

    data = ( FilePropertiesDialogData* ) g_object_get_data( G_OBJECT( dialog ),
                                                            "DialogData" );
    if ( data )
    {
        if ( data->update_label_timer )
            g_source_remove( data->update_label_timer );
        data->cancel = TRUE;

        if ( data->calc_size_thread )
            g_thread_join( data->calc_size_thread );

        if ( response_id == GTK_RESPONSE_OK )
        {
            // change file dates
            char* cmd = NULL;
            char* quoted_time;
            char* quoted_path;
            const char* new_mtime = gtk_entry_get_text( data->mtime );
            if ( !( new_mtime && new_mtime[0] ) || 
                                !g_strcmp0( data->orig_mtime, new_mtime ) )
                new_mtime = NULL;
            const char* new_atime = gtk_entry_get_text( data->atime );
            if ( !( new_atime && new_atime[0] ) || 
                                !g_strcmp0( data->orig_atime, new_atime ) )
                new_atime = NULL;
            
            if ( ( new_mtime || new_atime ) && data->file_list )
            {
                GString* gstr = g_string_new( NULL );
                for ( l = data->file_list; l; l = l->next )
                {
                    file_path = g_build_filename( data->dir_path,
                                                  ((VFSFileInfo*)l->data)->name,
                                                  NULL );
                    quoted_path = bash_quote( file_path );
                    g_string_append_printf( gstr, " %s", quoted_path );
                    g_free( file_path );
                    g_free( quoted_path );
                }
                    
                if ( new_mtime )
                {
                    quoted_time = bash_quote( new_mtime );
                    cmd = g_strdup_printf( "touch --no-dereference --no-create -m -d %s%s",
                                                                quoted_time,
                                                                gstr->str );
                }
                if ( new_atime )
                {
                    quoted_time = bash_quote( new_atime );
                    quoted_path = cmd;  // temp str
                    cmd = g_strdup_printf( "%s%stouch --no-dereference --no-create -a -d %s%s",
                                                                cmd ? cmd : "",
                                                                cmd ? "\n" : "",
                                                                quoted_time,
                                                                gstr->str );
                    g_free( quoted_path );
                }
                g_free( quoted_time );
                g_string_free( gstr, TRUE );
                if ( cmd )
                {
                    task = ptk_file_exec_new( _("Change File Date"), "/",
                                              GTK_WIDGET( dialog ), NULL );
                    task->task->exec_command = cmd;
                    task->task->exec_sync = TRUE;
                    task->task->exec_export = FALSE;
                    task->task->exec_show_output = TRUE;
                    task->task->exec_show_error = TRUE;
                    ptk_file_task_run( task );
                }
            }
        
            /* Set default action for mimetype */
            GtkWidget* open_with;
            if( ( open_with = (GtkWidget*)g_object_get_data( G_OBJECT(dialog), "open_with" ) ) )
            {
                GtkTreeModel* model = gtk_combo_box_get_model( GTK_COMBO_BOX(open_with) );
                GtkTreeIter it;

                if( model && gtk_combo_box_get_active_iter( GTK_COMBO_BOX(open_with), &it ) )
                {
                    char* action;
                    gtk_tree_model_get( model, &it, 2, &action, -1 );
                    if( action )
                    {
                        file = ( VFSFileInfo* ) data->file_list->data;
                        VFSMimeType* mime = vfs_file_info_get_mime_type( file );
                        vfs_mime_type_set_default_action( mime, action );
                        vfs_mime_type_unref( mime );
                        g_free( action );
                    }
                }
            }

            /* Check if we need chown */
            owner_name = gtk_entry_get_text( data->owner );
            if ( owner_name && *owner_name &&
                 (!data->owner_name || strcmp( owner_name, data->owner_name ) ) )
            {
                uid = uid_from_name( owner_name );
                if ( uid == -1 )
                {
                    ptk_show_error( GTK_WINDOW( dialog ), _("Error"), _( "Invalid User" ) );
                    return ;
                }
            }
            group_name = gtk_entry_get_text( data->group );
            if ( group_name && *group_name &&
                 (!data->group_name || strcmp( group_name, data->group_name ) ) )
            {
                gid = gid_from_name( group_name );
                if ( gid == -1 )
                {
                    ptk_show_error( GTK_WINDOW( dialog ), _("Error"), _( "Invalid Group" ) );
                    return ;
                }
            }

            for ( i = 0; i < N_CHMOD_ACTIONS; ++i )
            {
                if ( gtk_toggle_button_get_inconsistent( data->chmod_btns[ i ] ) )
                {
                    data->chmod_states[ i ] = 2;  /* Don't touch this bit */
                }
                else if ( data->chmod_states[ i ] != gtk_toggle_button_get_active( data->chmod_btns[ i ] ) )
                {
                    mod_change = TRUE;
                    data->chmod_states[ i ] = gtk_toggle_button_get_active( data->chmod_btns[ i ] );
                }
                else /* Don't change this bit */
                {
                    data->chmod_states[ i ] = 2;
                }
            }

            if ( uid != -1 || gid != -1 || mod_change )
            {
                file_list = NULL;
                for ( l = data->file_list; l; l = l->next )
                {
                    file = ( VFSFileInfo* ) l->data;
                    file_path = g_build_filename( data->dir_path,
                            vfs_file_info_get_name( file ), NULL );
                    file_list = g_list_prepend( file_list, file_path );
                }

                task = ptk_file_task_new( VFS_FILE_TASK_CHMOD_CHOWN,
                                          file_list,
                                          NULL,
                                          GTK_WINDOW(gtk_widget_get_parent( GTK_WIDGET( dialog ) )),
                                          NULL );
                //MOD
                ptk_file_task_set_recursive( task,
                                        gtk_toggle_button_get_active(
                                        GTK_TOGGLE_BUTTON( data->recurse ) ) );
                /*
                for ( l = data->file_list; l; l = l->next )
                {
                    file = ( VFSFileInfo* ) l->data;
                    if ( vfs_file_info_is_dir( file ) )
                    {
                        ask_recursive = gtk_message_dialog_new(
                                            GTK_WINDOW( data->dlg ),
                                            GTK_DIALOG_MODAL,
                                            GTK_MESSAGE_QUESTION,
                                            GTK_BUTTONS_YES_NO,
                                            _( "Do you want to recursively apply these changes to all files and sub-folders?" ) );
                        ptk_file_task_set_recursive( task,
                                ( GTK_RESPONSE_YES == gtk_dialog_run( GTK_DIALOG( ask_recursive ) ) ) );
                        gtk_widget_destroy( ask_recursive );
                        break;
                    }
                }
                */
                if ( mod_change )
                {
                     /* If the permissions of file has been changed by the user */
                    ptk_file_task_set_chmod( task, data->chmod_states );
                }
                /* For chown */
                ptk_file_task_set_chown( task, uid, gid );
                ptk_file_task_run( task );

                /*
                * This file list will be freed by file operation, so we don't
                * need to do this. Just set the pointer to NULL.
                */
                data->file_list = NULL;
            }
        }

        g_free( data->owner_name );
        g_free( data->group_name );
        g_free( data->orig_mtime );
        g_free( data->orig_atime );
        /*
         *NOTE: File operation chmod/chown will free the list when it's done,
         *and we only need to free it when there is no file operation applyed.
        */
        g_slice_free( FilePropertiesDialogData, data );
    }

    gtk_widget_destroy( GTK_WIDGET( dialog ) );
}
static void
image_scale_dialog_free (ImageScaleDialog *dialog)
{
  g_slice_free (ImageScaleDialog, dialog);
}
static void
weak_ref_free (GWeakRef * ref)
{
  g_weak_ref_clear (ref);
  g_slice_free (GWeakRef, ref);
}
Esempio n. 25
0
static void
uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad,
    GstDiscoverer * dc)
{
  PrivateStream *ps;
  GstPad *sinkpad = NULL;
  GstCaps *caps;
  static GstCaps *subs_caps = NULL;

  if (!subs_caps) {
    subs_caps = gst_caps_from_string ("text/plain; text/x-pango-markup; "
        "subpicture/x-pgs; subpicture/x-dvb; application/x-subtitle-unknown; "
        "application/x-ssa; application/x-ass; subtitle/x-kate; "
        "video/x-dvd-subpicture; ");
  }

  GST_DEBUG_OBJECT (dc, "pad %s:%s", GST_DEBUG_PAD_NAME (pad));

  ps = g_slice_new0 (PrivateStream);

  ps->dc = dc;
  ps->pad = pad;
  ps->queue = gst_element_factory_make ("queue", NULL);
  ps->sink = gst_element_factory_make ("fakesink", NULL);

  if (G_UNLIKELY (ps->queue == NULL || ps->sink == NULL))
    goto error;

  g_object_set (ps->sink, "silent", TRUE, NULL);
  g_object_set (ps->queue, "max-size-buffers", 1, "silent", TRUE, NULL);

  caps = gst_pad_get_caps_reffed (pad);

  if (gst_caps_can_intersect (caps, subs_caps)) {
    /* Subtitle streams are sparse and don't provide any information - don't
     * wait for data to preroll */
    g_object_set (ps->sink, "async", FALSE, NULL);
  }

  gst_caps_unref (caps);

  gst_bin_add_many (dc->priv->pipeline, ps->queue, ps->sink, NULL);

  if (!gst_element_link_pads_full (ps->queue, "src", ps->sink, "sink",
          GST_PAD_LINK_CHECK_NOTHING))
    goto error;
  if (!gst_element_sync_state_with_parent (ps->sink))
    goto error;
  if (!gst_element_sync_state_with_parent (ps->queue))
    goto error;

  sinkpad = gst_element_get_static_pad (ps->queue, "sink");
  if (sinkpad == NULL)
    goto error;
  if (gst_pad_link_full (pad, sinkpad,
          GST_PAD_LINK_CHECK_NOTHING) != GST_PAD_LINK_OK)
    goto error;
  gst_object_unref (sinkpad);

  /* Add an event probe */
  gst_pad_add_event_probe (pad, G_CALLBACK (_event_probe), ps);

  DISCO_LOCK (dc);
  dc->priv->streams = g_list_append (dc->priv->streams, ps);
  DISCO_UNLOCK (dc);

  GST_DEBUG_OBJECT (dc, "Done handling pad");

  return;

error:
  GST_ERROR_OBJECT (dc, "Error while handling pad");
  if (sinkpad)
    gst_object_unref (sinkpad);
  if (ps->queue)
    gst_object_unref (ps->queue);
  if (ps->sink)
    gst_object_unref (ps->sink);
  g_slice_free (PrivateStream, ps);
  return;
}
Esempio n. 26
0
void g_checksum_free(GChecksum *ctx)
{
  g_slice_free(GChecksum, ctx);
}
Esempio n. 27
0
static void collect_info_free(liCollectInfo *ci) {
	g_ptr_array_free(ci->results, TRUE);
	g_slice_free(liCollectInfo, ci);
}
Esempio n. 28
0
int main(int argc, char *argv[]) {
    gtk_init(&argc, &argv);

    GtkBuilder *builder = gtk_builder_new();
    AuthManager *authManager = g_slice_new(AuthManager);
    GError *error = NULL;

    if (!gtk_builder_add_from_file(builder, "authmanager.glade", &error)) {
        g_print(
                "Error occurred while loading UI description from file (authmanager.glade)!\n");
        g_print("Message: %s\n", error->message);
        g_free(error);
        g_slice_free(AuthManager, authManager);
        return (1);
    }

    authManager->window = GTK_WIDGET(
            gtk_builder_get_object(builder, "mainwindow"));
    authManager->key_store = GTK_LIST_STORE(
            gtk_builder_get_object(builder, "KeyStore"));
    authManager->key_view = GTK_TREE_VIEW(
            gtk_builder_get_object(builder, "KeyView"));

    authManager->errordialog_nodir = GTK_WIDGET(
            gtk_builder_get_object(builder, "errordialog_nodir"));

    authManager->enabled_renderer = GTK_CELL_RENDERER(
            gtk_builder_get_object(builder, "cellrenderertoggle_enabled"));
    authManager->info_renderer = GTK_CELL_RENDERER(
            gtk_builder_get_object(builder, "cellrendererpixbuf_info"));
    authManager->edit_renderer = GTK_CELL_RENDERER(
            gtk_builder_get_object(builder, "cellrendererpixbuf_edit"));
    authManager->delete_renderer = GTK_CELL_RENDERER(
            gtk_builder_get_object(builder, "cellrendererpixbuf_delete"));

    authManager->newdialog.window = GTK_WIDGET(
            gtk_builder_get_object(builder, "newdialog_window"));
    authManager->newdialog.entry_authname = GTK_ENTRY(
            gtk_builder_get_object(builder, "newdialog_entry_authname"));
    authManager->newdialog.entry_privkey = GTK_ENTRY(
            gtk_builder_get_object(builder, "newdialog_entry_privkey"));
    authManager->newdialog.entry_domain = GTK_ENTRY(
            gtk_builder_get_object(builder, "newdialog_entry_domain"));

    authManager->editdialog.window = GTK_WIDGET(
            gtk_builder_get_object(builder, "editdialog_window"));
    authManager->editdialog.entry_authname = GTK_ENTRY(
            gtk_builder_get_object(builder, "editdialog_entry_authname"));
    authManager->editdialog.entry_privkey = GTK_ENTRY(
            gtk_builder_get_object(builder, "editdialog_entry_privkey"));
    authManager->editdialog.entry_domain = GTK_ENTRY(
            gtk_builder_get_object(builder, "editdialog_entry_domain"));

    authManager->infodialog.window = GTK_WIDGET(
            gtk_builder_get_object(builder, "infodialog_window"));

    authManager->infodialog.label_authname = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_authname"));
    authManager->infodialog.label_privkey = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_privkey"));
    authManager->infodialog.label_pubkey = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_pubkey"));
    authManager->infodialog.label_domain = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_domain"));
    authManager->infodialog.label_location = GTK_LABEL(
            gtk_builder_get_object(builder, "infodialog_info_location"));

    gtk_builder_connect_signals(builder, authManager);

    g_object_unref(G_OBJECT(builder));

    gtk_widget_show(authManager->window);

    GTK_CELL_RENDERER_TOGGLE(authManager->enabled_renderer)->activatable = true;

    GtkIconTheme *icon_theme = gtk_icon_theme_get_default();

    authManager->info_icon_pixbuf = get_stock_icon(icon_theme,
            "Icons"FS_DELIM"200px-Gnome-dialog-information.png");
    authManager->edit_icon_pixbuf = get_stock_icon(icon_theme,
            "Icons"FS_DELIM"200px-Gnome-accessories-text-editor.png");
    authManager->delete_icon_pixbuf = get_stock_icon(icon_theme,
            "Icons"FS_DELIM"200px-Gnome-edit-delete.png");

    if (!authManager->info_icon_pixbuf || !authManager->edit_icon_pixbuf
            || !authManager->delete_icon_pixbuf) {
        if (authManager->info_icon_pixbuf)
            g_object_unref(authManager->info_icon_pixbuf);
        if (authManager->edit_icon_pixbuf)
            g_object_unref(authManager->edit_icon_pixbuf);
        if (authManager->delete_icon_pixbuf)
            g_object_unref(authManager->delete_icon_pixbuf);
        g_slice_free(AuthManager, authManager);
        return (1);
    }

    if (!load_auth_information(authManager)) {
        gtk_dialog_run(GTK_DIALOG(authManager->errordialog_nodir));
    } else {
        gtk_main();
    }

    gtk_list_store_clear(authManager->key_store);

    freefb(&authManager->auth_cfg_buffer);
    freefb(&authManager->autoexec_cfg_buffer);

    if (authManager->auth_cfg_file)
        g_object_unref(authManager->auth_cfg_file);
    if (authManager->autoexec_cfg_file)
        g_object_unref(authManager->autoexec_cfg_file);

    if (authManager->auth_cfg_monitor)
        g_object_unref(authManager->auth_cfg_monitor);
    if (authManager->autoexec_cfg_monitor)
        g_object_unref(authManager->autoexec_cfg_monitor);

	if (authManager->sauer_home)
		free(authManager->sauer_home);
		
    if (authManager->info_icon_pixbuf)
        g_object_unref(authManager->info_icon_pixbuf);
    if (authManager->edit_icon_pixbuf)
        g_object_unref(authManager->edit_icon_pixbuf);
    if (authManager->delete_icon_pixbuf)
        g_object_unref(authManager->delete_icon_pixbuf);

    g_slice_free(AuthManager, authManager);
    return 0;
}
Esempio n. 29
0
static void
free_camera_flush_state (void *user_data)
{
  CameraFlushState *state = user_data;
  g_slice_free (CameraFlushState, state);
}
Esempio n. 30
0
static void
image_resize_options_free (ImageResizeOptions *options)
{
  g_slice_free (ImageResizeOptions, options);
}