示例#1
0
void win2CharReset ()
{
    Player1.name = "Default";
    Player2.name = "Default";
    gtk_image_set_from_file (GTK_IMAGE(win2MiddleFirst),"images/facelessVoid.png");
    gtk_image_set_from_file (GTK_IMAGE(win2MiddleSecond),"images/facelessVoid.png");
};
示例#2
0
文件: talking.c 项目: shr-project/shr
void
moko_talking_incoming_call (MokoTalking      *talking,
                            const gchar      *number,
                            MokoContactEntry *entry)
{
  MokoTalkingPrivate *priv;

  moko_talking_reset_ui (talking);

  g_return_if_fail (MOKO_IS_TALKING (talking));
  priv = talking->priv;

  gtk_widget_hide (priv->main_bar);
  gtk_widget_show_all (priv->incoming_bar);

  gtk_window_set_title (GTK_WINDOW (priv->window), "Incoming Call");
  gtk_label_set_text (GTK_LABEL (priv->title), "Incoming Call");
  gtk_label_set_text (GTK_LABEL (priv->duration), "");
  gtk_image_set_from_file (GTK_IMAGE (priv->icon),
                           PKGDATADIR"/incoming_3.png");

  gtk_label_set_text (GTK_LABEL (priv->status), number);
  gtk_image_set_from_file (GTK_IMAGE (priv->person),
                           PKGDATADIR"/unknown.png");
  if (priv->timeout)
    g_source_remove (priv->timeout);
  priv->timeout = g_timeout_add (1000,
                                 (GSourceFunc)incoming_timeout,
                                 (gpointer)talking);
  priv->call_direction = CALL_DIRECTION_INCOMING;
  gtk_window_present (GTK_WINDOW (priv->window));
  gtk_window_deiconify (GTK_WINDOW (priv->window));
}
示例#3
0
void set_toolbar_images()
{
  GtkWidget *w;
  gchar loc[1024];

  w = get_widget_checked("source_load_button");
  //gtk_button_set_label(GTK_BUTTON(w), " Browse...");
  w = get_widget_checked("source_load_button_image");
  img_loc(loc, "folder_s.png");
  gtk_image_set_from_file(GTK_IMAGE(w), loc);

  w = get_widget_checked("source_save_button");
  //gtk_button_set_label(GTK_BUTTON(w), " Save...");
  w = get_widget_checked("source_save_button_image");
  img_loc(loc, "save_as.png");
  gtk_image_set_from_file(GTK_IMAGE(w), loc);

  w = get_widget_checked("target_load_button");
  //gtk_button_set_label(GTK_BUTTON(w), " Browse...");
  w = get_widget_checked("target_load_button_image");
  img_loc(loc, "folder_s.png");
  gtk_image_set_from_file(GTK_IMAGE(w), loc);

  w = get_widget_checked("target_save_button");
  //gtk_button_set_label(GTK_BUTTON(w), " Save...");
  w = get_widget_checked("target_save_button_image");
  img_loc(loc, "save_as.png");
  gtk_image_set_from_file(GTK_IMAGE(w), loc);
}
示例#4
0
void disp_win_screen_status(char *in_method, char *half_status)
{
  dbg("disp_win_screen_status\n");
  if (
//  tss.c_len || ggg.gbufN ||
  cur_file_hf && !strcmp(cur_file_hf, half_status) &&
  cur_file_inmd && !strcmp(cur_file_inmd, in_method) 
#if 0  
  && old_x==current_in_win_x && old_y==current_in_win_y
#endif  
  )
    return;
    
  old_x = current_in_win_x;
  old_y = current_in_win_y;

  clear_timeout();
  free(cur_file_hf); cur_file_hf = strdup(half_status);
  free(cur_file_inmd); cur_file_inmd = strdup(in_method);

  if (!win_screen_status) {
    win_screen_status = create_no_focus_win();
    GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
    gtk_container_add(GTK_CONTAINER(win_screen_status), hbox);
    icon_inmd = gtk_image_new_from_file(in_method);
    gtk_box_pack_start (GTK_BOX (hbox), icon_inmd, FALSE, FALSE, 0);
#if 1
    icon_hf = gtk_image_new_from_file(half_status);
    gtk_box_pack_start (GTK_BOX (hbox), icon_hf, FALSE, FALSE, 0);
#endif    
  } else {
#if 1
    gtk_image_set_from_file(GTK_IMAGE(icon_hf), half_status);
#endif
    gtk_image_set_from_file(GTK_IMAGE(icon_inmd), in_method);
  }

  gtk_widget_show_all(win_screen_status);
  gtk_window_present(GTK_WINDOW(win_screen_status));

  timeout_handle = g_timeout_add(1000, timeout_hide, NULL);
  int w,h;
  get_win_size(win_screen_status, &w, &h);

  int x = current_in_win_x;
  int y = current_in_win_y + (win_is_visible()?win_yl:0);


  if (x + w > dpy_xl)
    x = dpy_xl - w;

  if (y + h > dpy_yl)
    y = win_y - h;

  gtk_window_move(GTK_WINDOW(win_screen_status), x, y);
}
示例#5
0
void backToChoosingScreen()
{
    gtk_widget_hide(win);
    gtk_widget_show_all(win2win);
    gtk_image_set_from_file(GTK_IMAGE(leftImage),"images/filler.PNG");
    gtk_image_set_from_file(GTK_IMAGE(rightImage),"images/filler.PNG");
    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(leftBar),0.0);
    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(rightBar),0.0);
    write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
    std::cout<<"\nWindows changed!"<<std::endl;
    win2CharReset();
};
示例#6
0
static int on_mixer_elem_event(snd_mixer_elem_t *elem, unsigned int mask) {
  snd_mixer_selem_id_t *sid;
  void *data = NULL;

  if(elem)
    data = snd_mixer_elem_get_callback_private(elem);

  if(data) {
    long min, max, Rvol, Lvol;

    snd_mixer_selem_id_alloca(&sid);
    snd_mixer_selem_get_id(elem, sid);
    DEBUG("mixer elem control = %s, mask = %x, data = %x\n", snd_mixer_selem_id_get_name(sid), mask, data);
    if(mask & SND_CTL_EVENT_MASK_VALUE) {
      char path[1024] = {0};
      alsa_mixer_t *mixer = (alsa_mixer_t *)g_object_get_data(G_OBJECT(data), "mixer-obj");
      GtkWidget *img = (GtkWidget *)g_object_get_data(G_OBJECT(data), "image-obj");

      DEBUG("mixer = %x, img = %x\n", mixer, img);
      if(snd_mixer_selem_has_playback_volume(elem)) {
        if(mixer->pcm_muted != alsa_mixer_is_muted(elem, NULL)) {
          mixer->pcm_muted = !mixer->pcm_muted;
          g_snprintf(path, 1024, DVM_CONFIG_PATH"/%s", g_playback_iconset[mixer->pcm_muted ? 3: 0]);
          DEBUG("playback switch detected, image path = %s\n", path);
          gtk_image_set_from_file(GTK_IMAGE(img), path);
        }

        snd_mixer_selem_get_playback_volume(elem, 0, &Rvol);
        snd_mixer_selem_get_playback_volume(elem, 1, &Lvol);
        snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
        DEBUG("new val = %d, %d, min = %d, max = %d\n", Rvol, Lvol, min, max);
      } else if(snd_mixer_selem_has_capture_volume(elem)) {
        if(mixer->mic_muted != alsa_mixer_is_muted(elem, NULL)) {
          mixer->mic_muted = !mixer->mic_muted;
          g_snprintf(path, 1024, DVM_CONFIG_PATH"/%s", g_capture_iconset[mixer->mic_muted ? 3: 0]);
          DEBUG("capture switch detected, image path = %s\n", path);
          gtk_image_set_from_file(GTK_IMAGE(img), path);
        }

        snd_mixer_selem_get_capture_volume_range(elem, &min, &max);
        snd_mixer_selem_get_capture_volume(elem, 0, &Rvol);
        snd_mixer_selem_get_capture_volume(elem, 1, &Lvol);
        DEBUG("new val = %d, %d, min = %d, max = %d\n", Rvol, Lvol, min, max);
      }
      g_mixer_ui_updated = TRUE;
      gtk_adjustment_set_value(GTK_ADJUSTMENT(data), ((gdouble)(Rvol+Lvol)*50)/(max-min));
    }
  }

  return 0;
}
示例#7
0
void win2pikachuSelect()
{
    win2Init();
    if (Player1.name == "Default")
    {
        Player1=pikachu;
        gtk_image_set_from_file (GTK_IMAGE(win2MiddleFirst),"images/ImagePikachuSmall.png");
    }
    else if(Player2.name == "Default")
    {
        Player2=pikachu;
        gtk_image_set_from_file (GTK_IMAGE(win2MiddleSecond),"images/ImagePikachuSmall.png");
    };
};
示例#8
0
static void set_button_images()
{
    GtkWidget * w = get_widget_checked("google_earth_image");
    gtk_image_set_from_file(GTK_IMAGE(w), imgloc("google_earth_button.gif"));

    w = get_widget_checked("mdv_image");
    gtk_image_set_from_file(GTK_IMAGE(w), imgloc("ceos_metadata.png"));

    w = get_widget_checked("save_subset_image");
    gtk_image_set_from_file(GTK_IMAGE(w), imgloc("save_as.png"));

    w = get_widget_checked("save_setup_image");
    gtk_image_set_from_file(GTK_IMAGE(w), imgloc("save_as.png"));
}
示例#9
0
void win2gardevoirSelect()
{
    win2Init();
    if (Player1.name == "Default")
    {
        Player1=gardevoir;
        gtk_image_set_from_file (GTK_IMAGE(win2MiddleFirst),"images/ImageGardevoirSmall.png");
    }
    else if(Player2.name == "Default")
    {
        Player2=gardevoir;
        gtk_image_set_from_file (GTK_IMAGE(win2MiddleSecond),"images/ImageGardevoirSmall.png");
    };
};
示例#10
0
void win2mightyfishSelect()
{
    win2Init();
    if (Player1.name == "Default")
    {
        Player1=mightyfish;
        gtk_image_set_from_file (GTK_IMAGE(win2MiddleFirst),"images/ImageFishSmall.png");
    }
    else if(Player2.name == "Default")
    {
        Player2=mightyfish;
        gtk_image_set_from_file (GTK_IMAGE(win2MiddleSecond),"images/ImageFishSmall.png");
    };
};
示例#11
0
void win2arcanineSelect()
{
    win2Init();
    if (Player1.name == "Default")
    {
        Player1=arcanine;
        gtk_image_set_from_file (GTK_IMAGE(win2MiddleFirst),"images/ImageArcanineSmall.png");
    }
    else if(Player2.name == "Default")
    {
        Player2=arcanine;
        gtk_image_set_from_file (GTK_IMAGE(win2MiddleSecond),"images/ImageArcanineSmall.png");
    };
};
示例#12
0
void verificarCasilla(int coordX,int coordY,laberinto* maze,bool paredArriba,bool paredAbajo,bool paredDerecha,bool paredIzquierda, char* nombreImagen){
    int xLog = coordX;
    int yLog = coordY;
    if(maze->matrizLogica[xLog][yLog].paredArriba == paredArriba &&
                maze->matrizLogica[xLog][yLog].paredAbajo == paredAbajo &&
                maze->matrizLogica[xLog][yLog].paredDerecha == paredDerecha &&
                maze->matrizLogica[xLog][yLog].paredIzquierda == paredIzquierda ){
                    bool queso = maze->matrizLogica[xLog][yLog].queso;
                    bool veneno = maze->matrizLogica[xLog][yLog].veneno;
                    printf("\nCambiaron paredes 1 = %d 2 = %d 3 = %d 4 = %d del valor %d\n",
                        paredArriba,paredAbajo,paredDerecha,paredIzquierda,maze->matrizLogica[xLog][yLog].valor);
                    gtk_image_set_from_file (((GtkImage*)maze->matrizGrafica[xLog][yLog]),nombreImagen);
                if(queso||veneno){
                    if(nombreImagen == "fondo.png")
                        nombreImagen = elegirImagen("fondo",veneno);
                    if(nombreImagen == "1.png")
                        nombreImagen = elegirImagen("1",veneno);
                    if(nombreImagen == "2.png")
                        nombreImagen = elegirImagen("2",veneno);
                    if(nombreImagen == "3.png")
                        nombreImagen = elegirImagen("3",veneno);
                    if(nombreImagen == "4.png")
                        nombreImagen = elegirImagen("4",veneno);
                    if(nombreImagen == "5.png")
                        nombreImagen = elegirImagen("5",veneno);
                    if(nombreImagen == "6.png")
                        nombreImagen = elegirImagen("6",veneno);
                    if(nombreImagen == "7.png")
                        nombreImagen = elegirImagen("7",veneno);
                    if(nombreImagen == "8.png")
                        nombreImagen = elegirImagen("8",veneno);
                    if(nombreImagen == "9.png")
                        nombreImagen = elegirImagen("9",veneno);
                    if(nombreImagen == "10.png")
                        nombreImagen = elegirImagen("10",veneno);
                    if(nombreImagen == "11.png")
                        nombreImagen = elegirImagen("11",veneno);
                    if(nombreImagen == "12.png")
                        nombreImagen = elegirImagen("12",veneno);
                    if(nombreImagen == "13.png")
                        nombreImagen = elegirImagen("13",veneno);
                    if(nombreImagen == "14.png")
                        nombreImagen = elegirImagen("14",veneno);
                    if(nombreImagen == "15.png")
                        nombreImagen = elegirImagen("15",veneno);
                }
                gtk_image_set_from_file(((GtkImage*)maze->matrizGrafica[xLog][yLog]),nombreImagen);
    }
}
示例#13
0
pchatbox_t *new_pchatbox(ifreechat_t *ifc, user_t *user) {
	pchatbox_t *pchatbox;
	dlist_t *pchatbox_list;

	char title[128];
	GladeXML *xml;
	GtkTextBuffer *display_buffer;

	pchatbox = (pchatbox_t*)malloc(sizeof(pchatbox_t));

	init_chatbox(ifc, pchatbox, PCHATBOX, (void*)user);

	pthread_mutex_lock(&(ifc->pchatbox_lock));
	dlist_add_tail(&(pchatbox->chatbox_node), &(ifc->pchatbox));
	pthread_mutex_unlock(&(ifc->pchatbox_lock));

	sprintf(title, "Chat with %s", user->nickname);
	gtk_window_set_title((GtkWindow*)pchatbox->window, title);
	gtk_image_set_from_file(pchatbox->avatar_image, user->avatar);
	gtk_label_set_text(pchatbox->first_label, user->nickname);
	gtk_label_set_text(pchatbox->second_label, ""/*user->signature*/);


	chatbox_set_sendmsg_func(pchatbox, on_send_message);
	show_chatbox(pchatbox);
	return pchatbox;
}
static void
setup_scroll_image (GtkWidget *widget)
{
	static struct test_data_t data;
	char *filename;

	if (scroll_image_timeout_id != 0) {
		g_source_remove (scroll_image_timeout_id);
		scroll_image_timeout_id = 0;
	}

	if (double_click_state == DOUBLE_CLICK_TEST_GEGL)
		filename = CINNAMONCC_UI_DIR "/scroll-test-gegl.svg";
	else
		filename = CINNAMONCC_UI_DIR "/scroll-test.svg";
	gtk_image_set_from_file (GTK_IMAGE (widget), filename);

	if (double_click_state != DOUBLE_CLICK_TEST_GEGL)
		return;

	data.widget = widget;
	data.timeout_id = &scroll_image_timeout_id;
	scroll_image_timeout_id = g_timeout_add (5000,
						 (GSourceFunc) scroll_image_timeout,
						 &data);
}
static void close_button_class_init(CloseButtonClass* klass)
{
  GTK_WIDGET_CLASS(klass)->draw = [] (GtkWidget* self, cairo_t* cr) {
    gtk_widget_draw(GTK_WIDGET(CLOSE_BUTTON(self)->priv->img), cr);
    return TRUE;
  };

  GTK_WIDGET_CLASS(klass)->state_flags_changed = [] (GtkWidget* self, GtkStateFlags prev_state) {
    auto* img = CLOSE_BUTTON(self)->priv->img;
    if (!img) return;

    auto new_flags = gtk_widget_get_state_flags(self);
    auto const& deco_style = decoration::Style::Get();
    auto file = deco_style->ThemedFilePath(CLOSE_BUTTON_INACTIVE_FILE, {PKGDATADIR"/"});

    if (((new_flags & GTK_STATE_FLAG_PRELIGHT) && !gtk_widget_get_can_focus(self)) ||
        (new_flags & GTK_STATE_FLAG_FOCUSED))
    {
      auto const& basename = (new_flags & GTK_STATE_FLAG_ACTIVE) ? CLOSE_BUTTON_ACTIVE_FILE : CLOSE_BUTTON_FOCUSED_FILE;
      file = deco_style->ThemedFilePath(basename, {PKGDATADIR"/"});
    }

    gtk_image_set_from_file(img, file.c_str());

    return GTK_WIDGET_CLASS(close_button_parent_class)->state_flags_changed(self, prev_state);
  };

  G_OBJECT_CLASS(klass)->finalize = [] (GObject* self) {
    CLOSE_BUTTON(self)->priv->img = nullptr;
    return G_OBJECT_CLASS(close_button_parent_class)->finalize(self);
  };
}
示例#16
0
static void
on_open_image (GtkButton* button, gpointer user_data)
{
	GtkWidget *image = GTK_WIDGET (user_data);
	GtkWidget *toplevel = gtk_widget_get_toplevel (image);
	GtkFileFilter *filter = gtk_file_filter_new ();
	GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Open image"),
	                                                 GTK_WINDOW (toplevel),
	                                                 GTK_FILE_CHOOSER_ACTION_OPEN,
	                                                 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
	                                                 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
	                                                 NULL);

	gtk_file_filter_add_pixbuf_formats (filter);
	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog),
	                             filter);
	
	switch (gtk_dialog_run (GTK_DIALOG (dialog)))
	{
		case GTK_RESPONSE_ACCEPT:
		{
			gchar *filename = 
				gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
			gtk_image_set_from_file (GTK_IMAGE (image), filename);
			break;
		}
		default:
			break;
	}
	gtk_widget_destroy (dialog);
}
示例#17
0
文件: main.c 项目: wavs/ocre
/*
** opens an "Open File" dialog
*/
void on_open_show (GtkImageMenuItem* test, gpointer user_data)
{
  GtkWidget* open;
  GUI_* guisex;
  /* so there's no unused parameter... */
  (void)test;
  guisex = (GUI_ *)user_data;
  /* create an open file dialog */
  open = gtk_file_chooser_dialog_new (NULL,
				      NULL,
				      GTK_FILE_CHOOSER_ACTION_OPEN,
				      GTK_STOCK_OPEN,
				      GTK_RESPONSE_ACCEPT,
				      GTK_STOCK_CANCEL,
				      GTK_RESPONSE_CANCEL,
				      NULL);
  gtk_widget_show(open);
  if (gtk_dialog_run (GTK_DIALOG (open)) == GTK_RESPONSE_ACCEPT)
    {
      char *filename;
      char* appel = malloc(sizeof(char *));
      /* get the filename */
      filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER
    					(open));
      guisex->file = filename;
      /* resize */
      sprintf(appel, "../bin/OCRed -i %s --resize-auto", guisex->file);
      system(appel);
      /* open the file */
      gtk_image_set_from_file(GTK_IMAGE(guisex->image), "../resize.bmp");
    }
  gtk_widget_destroy (open);
}
示例#18
0
int
main (int argc, char *argv[])
{
	GtkWidget  *dialog;
	GtkWidget  *browse_button;
	GtkWidget  *help_button;
	GtkWidget  *face_image;	
	char	   *greeter;
	int	    max_size;

	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	gtk_init(&argc, &argv);
	photofile = g_build_filename (g_get_home_dir (), ".face", NULL);

	/* Read config data in bulk */
	mdmcomm_comm_bulk_start ();	
	max_size     = mdm_config_get_int (MDM_KEY_USER_MAX_FILE);
	max_width    = mdm_config_get_int (MDM_KEY_MAX_ICON_WIDTH);
	max_height   = mdm_config_get_int (MDM_KEY_MAX_ICON_HEIGHT);
	greeter      = mdm_config_get_string (MDM_KEY_GREETER);
	facedir      = mdm_config_get_string (MDM_KEY_GLOBAL_FACE_DIR);
	/* At this point we are done using the socket, so close it */
	mdmcomm_comm_bulk_stop ();
	imagename    = NULL;

	gtk_window_set_default_icon_name ("stock_person");

	xml = glade_xml_new (MDM_GLADE_DIR "/mdmphotosetup.glade", NULL, NULL);

	dialog	      = glade_xml_get_widget (xml, "face_dialog");
	face_image    = glade_xml_get_widget (xml, "face_image");
	browse_button = glade_xml_get_widget (xml, "browse_button");
	help_button   = glade_xml_get_widget (xml, "helpbutton1");

	gtk_widget_set_size_request (browse_button, MAX (max_width, 230), MAX (max_height, 130));

	if (g_access (photofile, R_OK) == 0) {
		gtk_image_set_from_file (GTK_IMAGE (face_image),
					 photofile);
	} else {
		gtk_image_set_from_icon_name (GTK_IMAGE (face_image),
					      "stock_person",
					      GTK_ICON_SIZE_DIALOG);
	}

	g_signal_connect (browse_button, "clicked",
			  G_CALLBACK (browse_button_cb), dialog);
	g_signal_connect (help_button, "clicked",
			  G_CALLBACK (help_button_cb), dialog);

	g_signal_connect (dialog, "response",
			  G_CALLBACK (dialog_response), NULL);

	gtk_widget_show_all (dialog);
	gtk_main ();

	return 0;
}
示例#19
0
文件: talking.c 项目: shr-project/shr
void
moko_talking_set_clip (MokoTalking      *talking,
                       const gchar      *number,
                       MokoContactEntry *entry)
{
  MokoTalkingPrivate *priv;
  gchar *markup;

  g_return_if_fail (MOKO_IS_TALKING (talking));
  priv = talking->priv;

  if (number == NULL)
    number = "Unknown number";

  if (entry)
    markup = g_strdup_printf ("<b>%s</b>\n%s", entry->contact->name, number);
  else
    markup = g_strdup (number);

  gtk_label_set_markup (GTK_LABEL (priv->status), markup);

  if (entry && GDK_IS_PIXBUF (entry->contact->photo))
    gtk_image_set_from_pixbuf (GTK_IMAGE (priv->person), entry->contact->photo);
  else
    gtk_image_set_from_file (GTK_IMAGE (priv->person),
                             PKGDATADIR"/unknown.png");

  g_free (markup);
}
示例#20
0
static gboolean on_release_switch_widget (GtkWidget *widget, GdkEventButton *event, gpointer data) {
  char **iconset = g_object_get_data(G_OBJECT(widget), "iconset");
  alsa_mixer_t *mixer = (alsa_mixer_t *)data;
  gboolean muted, need_reset, *pmuted = NULL;
  snd_mixer_elem_t *elem = NULL;
  GtkWidget *img = NULL;
  char path[1024] = {0};

  img = gtk_bin_get_child(GTK_BIN(widget));
  if(iconset == (char **)g_playback_iconset) {
    DEBUG("release playback switch widget.\n");
    elem = mixer->master;
    pmuted = &mixer->pcm_muted;
  } else {
    DEBUG("release capture switch widget.\n");
    elem = mixer->mic;
    pmuted = &mixer->mic_muted;
  }

  if(elem) {
    muted = alsa_mixer_is_muted(elem, &need_reset);
    DEBUG("muted = %d\n", !muted);
    alsa_mixer_set_muted(elem, !muted);
    muted = alsa_mixer_is_muted(elem, &need_reset);
    *pmuted = muted;

    g_snprintf(path, 1024, DVM_CONFIG_PATH"/%s", iconset[muted ? 3: 0]);
    gtk_image_set_from_file(GTK_IMAGE(img), path);
  }

  return TRUE;
}
示例#21
0
/** \brief Callback to manage layout selection via combo box.
 *
 * This function is called when the user selects a new layout using the
 * layout selector combo box. The function updates the thumbnail and the
 * layout code text entry.
 */
static void layout_selected_cb (GtkComboBox *combo, gpointer data)
{
    gint   idx;
    gchar *icon;


    idx = gtk_combo_box_get_active (combo);
    if (idx < PREDEF_NUM) {
        dirty = TRUE;

        /* update icon */
        icon = thumb_file_from_sel (idx);
        gtk_image_set_from_file (GTK_IMAGE (thumb), icon);
        g_free (icon);

        /* update layout code, unless Custom is selected */
        if (idx < PREDEF_NUM-1) {
            g_signal_handler_block (gridstr, gridstr_sigid);
            gtk_entry_set_text (GTK_ENTRY (gridstr), predef_layout[idx][0]);
            g_signal_handler_unblock (gridstr, gridstr_sigid);
            gtk_widget_set_sensitive (gridstr, FALSE);
        }
        else {
            gtk_widget_set_sensitive (gridstr, TRUE);
        }
    }
}
示例#22
0
static gboolean on_enter_switch_widget (GtkWidget *widget, GdkEventCrossing *event, gpointer data) {
  char **iconset = g_object_get_data(G_OBJECT(widget), "iconset");
  alsa_mixer_t *mixer = (alsa_mixer_t *)data;
  gboolean muted, need_reset;
  snd_mixer_elem_t *elem = NULL;
  GtkWidget *img = NULL;
  char path[1024] = {0};

  img = gtk_bin_get_child(GTK_BIN(widget));
  if(iconset == (char **)g_playback_iconset) {
    elem = mixer->master;
    DEBUG("enter playback switch widget.\n");
  } else {
    elem = mixer->mic;
    DEBUG("enter capture switch widget.\n");
  }

  if(elem) {
    muted = alsa_mixer_is_muted(elem, &need_reset);

    g_snprintf(path, 1024, DVM_CONFIG_PATH"/%s", iconset[muted ? 4: 1]);
    gtk_image_set_from_file(GTK_IMAGE(img), path);
  }

  return TRUE;
}
示例#23
0
文件: gdaui-bar.c 项目: UIKit0/libgda
/**
 * gdaui_set_icon_from_file
 * @bar: a #GdauiBar widget.
 * @file: filename.
 *
 * Set the icon displayed in the given gray bar widget. This can include
 * embedded underlines indicating mnemonics or Pango markup.
 *
 */
void
gdaui_bar_set_icon_from_file (GdauiBar *bar, const gchar *file)
{
        g_return_if_fail (GDAUI_IS_BAR (bar));

        gtk_image_set_from_file (GTK_IMAGE (bar->priv->icon), file);
        gdaui_bar_set_show_icon (bar, TRUE);
}
示例#24
0
void
xmr_radio_set_logo(XmrRadio *radio,
                   const gchar *uri)
{
    g_return_if_fail(radio != NULL);

    gtk_image_set_from_file(GTK_IMAGE(radio->priv->image), uri);
}
示例#25
0
static void
gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
{
	GcmPickerPrivate *priv = (GcmPickerPrivate *) data;
	gboolean ret;
	g_autoptr(CdColorXYZ) tmp = NULL;
	g_autoptr(GError) error = NULL;

	/* reset the image */
	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image_preview"));
	gtk_image_set_from_file (GTK_IMAGE (widget), DATADIR "/icons/hicolor/64x64/apps/gnome-color-manager.png");

	/* lock */
	if (!cd_sensor_get_locked (priv->sensor)) {
		ret = cd_sensor_lock_sync (priv->sensor,
					   NULL,
					   &error);
		if (!ret) {
			g_warning ("failed to lock: %s", error->message);
			return;
		}
	}

	/* cancel pending unlock */
	if (priv->unlock_timer != 0) {
		g_source_remove (priv->unlock_timer);
		priv->unlock_timer = 0;
	}

	/* get color */
	tmp = cd_sensor_get_sample_sync (priv->sensor,
					 CD_SENSOR_CAP_LCD,
					 NULL,
					 &error);
	if (tmp == NULL) {
		g_warning ("failed to get sample: %s", error->message);
		goto out_unlock;
	}
	cd_color_xyz_copy (tmp, &priv->last_sample);
#if 0
	/* get ambient */
	ret = cd_sensor_get_sample_sync (priv->sensor,
					 CD_SENSOR_CAP_AMBIENT,
					 NULL,
					 &last_ambient,
					 NULL,
					 &error);
	if (!ret) {
		g_warning ("failed to get ambient: %s", error->message);
		goto out_unlock;
	}
#endif
out_unlock:
	/* unlock after a small delay */
	priv->unlock_timer = g_timeout_add_seconds (30, gcm_picker_unlock_timeout_cb, data);
	gcm_picker_refresh_results (priv);
	gcm_picker_got_results (priv);
}
static void
window_set_icon_file (GsdMediaKeysWindow *window,
                      const char         *path)
{
        if (window->priv->image == NULL)
                return;

        gtk_image_set_from_file (window->priv->image, path);
}
示例#27
0
void item_leave(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
	ITEM_IMG *item_img = (ITEM_IMG *)data;
	GtkImage *image = (GtkImage *)item_img->image;
	gint index = item_img->index;
	const gchar *img_file = item_normal_imgs[index];

	gtk_image_set_from_file(image, img_file);
}
示例#28
0
void
tray_icon_set_image (void *icon, const char *image)
{
	TrayIcon *ticon;
	if (icon == NULL)
		return;
	ticon = (TrayIcon *) icon;
	gtk_image_set_from_file (GTK_IMAGE (ticon->image),
				 (const gchar *) image);
}
示例#29
0
文件: ttx-window.c 项目: djcb/ttx
gboolean
ttx_window_set_image (TTXWindow *self, const char *path)
{
	g_return_val_if_fail (TTX_IS_WINDOW(self), FALSE);
	g_return_val_if_fail (path, FALSE);

	gtk_image_set_from_file (GTK_IMAGE(self->priv->image), path);

	return TRUE;
}
示例#30
0
void creatureImageAssign ()
{
    if (Attacker.name == "Pidgeot")
    {
        gtk_image_set_from_file (GTK_IMAGE(leftImage),"images/ImagePidgeot.png");
    }
    else if (Attacker.name == "Gardevoir")
    {
        gtk_image_set_from_file (GTK_IMAGE(leftImage),"images/ImageGardevoir.png");
    }
    else if (Attacker.name == "Goldking")
    {
        gtk_image_set_from_file (GTK_IMAGE(leftImage),"images/ImageFish.png");
    }
    else if (Attacker.name == "Arcanine")
    {
        gtk_image_set_from_file (GTK_IMAGE(leftImage),"images/ImageArcanine.png");
    }
    else if (Attacker.name == "Pikachu")
    {
        gtk_image_set_from_file (GTK_IMAGE(leftImage),"images/ImagePikachu.png");
    };
    if (Defender.name == "Pidgeot")
    {
        gtk_image_set_from_file (GTK_IMAGE(rightImage),"images/ImagePidgeot.png");
    }
    else if (Defender.name == "Gardevoir")
    {
        gtk_image_set_from_file (GTK_IMAGE(rightImage),"images/ImageGardevoir.png");
    }
    else if (Defender.name == "Goldking")
    {
        gtk_image_set_from_file (GTK_IMAGE(rightImage),"images/ImageFish.png");
    }
    else if (Defender.name == "Arcanine")
    {
        gtk_image_set_from_file (GTK_IMAGE(rightImage),"images/ImageArcanine.png");
    }
    else if (Defender.name == "Pikachu")
    {
        gtk_image_set_from_file (GTK_IMAGE(rightImage),"images/ImagePikachu.png");
    };
};