Exemple #1
0
static void
set_label(GtkWidget *dialog, const char *str) {
	GList *list;
	GtkWidget *hbox = NULL;

	list = gtk_container_children(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox));
	while (list != NULL) {
		GtkWidget *w = (GtkWidget *) list->data;
		list = g_list_next(list);
		if (GTK_IS_HBOX(w)) {
			hbox = w;
			break;
		}
	}
	if (hbox == NULL)
		return;
	list = gtk_container_children(GTK_CONTAINER(hbox));
	while (list != NULL) {
		GtkWidget *w = (GtkWidget *) list->data;
		list = g_list_next(list);
		if (GTK_IS_LABEL(w)) {
			gtk_label_set_text(GTK_LABEL(w), str);
			return;
		}
	}
}
Exemple #2
0
void PluginsMenu_clear(){
	m_nNextPlugInID = 0;

	GList* lst = g_list_find( gtk_container_children( GTK_CONTAINER( g_plugins_menu ) ), GTK_WIDGET( g_plugins_menu_separator ) );
	while ( lst->next )
	{
		gtk_container_remove( GTK_CONTAINER( g_plugins_menu ), GTK_WIDGET( lst->next->data ) );
		lst = g_list_find( gtk_container_children( GTK_CONTAINER( g_plugins_menu ) ),  GTK_WIDGET( g_plugins_menu_separator ) );
	}
}
void ui_player_control_update()
{
	GtkWidget *new_img;
	GtkWidget *old_img;

	struct ui_skin_image *status;
	struct ui_skin *a_skin;

	a_skin = ui_get_current_skin();

	/* get musci player status, is play set pause and change the image */
	if(player_get_status() == PLAYER_PLAY)
		status = a_skin->img_pause;
	else
		status = a_skin->img_play;
	
	old_img = GTK_WIDGET(gtk_container_children(GTK_CONTAINER(container))->data);

	gtk_container_remove(GTK_CONTAINER(container), old_img);

	new_img = gtk_image_new_from_file(status->src);

	gtk_container_add(GTK_CONTAINER(container), new_img);

	gtk_widget_show(new_img);
}
Exemple #4
0
void set_label_text_button(
	GtkButton *btn, const char *str,
	double HAlignment, double VAlignment
)
{
	if( btn == NULL )
		return;

	GList *ls = gtk_container_children(
			GTK_CONTAINER( btn ) );
	if( ls == NULL )
		return;

	GList *p = g_list_nth( ls, 0 );
	if( p == NULL )
		return;

	GtkLabel *label = GTK_LABEL( p->data );
	if( label == NULL )
		return;

	gtk_misc_set_alignment( GTK_MISC( label ), HAlignment, VAlignment );
	if( str == NULL )
		gtk_label_set_text( label, "" );
	else
		gtk_label_set_text( label, str );
}
static void
limited_int_update_value(node_gui_t *ng)
{
    GtkWidget *listw;
    GList *list;
    unsigned long value;

    value = cml_node_get_value(ng->node)->value.integer;
    
    listw = GTK_COMBO(ng->combo)->list;
    list = gtk_container_children(GTK_CONTAINER(listw));
    while (list != 0)
    {
    	GtkWidget *item = (GtkWidget *)list->data;
	unsigned long itemvalue;
	
	itemvalue = (unsigned long)gtk_object_get_user_data(GTK_OBJECT(item));
    	if (itemvalue == value)
	{
	    gtk_list_select_child(GTK_LIST(listw), item);
	    break;
	}
	
    	list = g_list_remove_link(list, list);
    }
    
    while (list != 0)
    	list = g_list_remove_link(list, list);
}
/*---------------------------------------------------------------------*/
obj_t
bglk_gtk_viewport_children( GtkContainer *c ) {
   GList *lst = gtk_container_children( c );

   if( lst )
      return bglk_gtk_container_children( lst->data );
   else
      return BNIL;
}
Exemple #7
0
/*
 * Create dialog window for font selection.
 */
int
font_dialog_window(GtkButton * button, gpointer user_data)
{
  GtkWidget *font_dialog;
  GtkWidget *vbox;
  GtkWidget *cancel_button, *apply_button, *ok_button;
  GList *children;

  DEBUG("font_dialog_window");
  font_dialog = gtk_font_selection_dialog_new("XOSD Font");

  assert(font_dialog);

  if (font)
    gtk_font_selection_dialog_set_font_name
      (GTK_FONT_SELECTION_DIALOG(font_dialog), font);

  children = gtk_container_children(GTK_CONTAINER(font_dialog));

  vbox = GTK_WIDGET(children->data);

  children = gtk_container_children(GTK_CONTAINER(vbox));

  vbox = GTK_WIDGET(children->next->data);
  children = gtk_container_children(GTK_CONTAINER(vbox));
  ok_button = GTK_WIDGET(children->data);

  apply_button = GTK_WIDGET(children->next->data);

  cancel_button = GTK_WIDGET(children->next->next->data);

  gtk_signal_connect_object(GTK_OBJECT(cancel_button), "clicked",
                            GTK_SIGNAL_FUNC(gtk_widget_destroy),
                            GTK_OBJECT(font_dialog));

  gtk_signal_connect(GTK_OBJECT(ok_button), "clicked",
                     GTK_SIGNAL_FUNC(font_dialog_ok), font_dialog);
  gtk_signal_connect(GTK_OBJECT(apply_button), "clicked",
                     GTK_SIGNAL_FUNC(font_dialog_apply), font_dialog);


  gtk_widget_show_all(font_dialog);
  return 0;
}
Exemple #8
0
Fichier : list.c Projet : dimkr/gtk
/* This is the signal handler that got connected to button
 * press/release events of the List
 */
void sigh_button_event( GtkWidget      *gtklist,
                        GdkEventButton *event,
                        GtkWidget      *frame )
{
    /* We only do something if the third (rightmost mouse button
     * was released
     */
    if (event->type==GDK_BUTTON_RELEASE &&
	event->button==3) {
	GList           *dlist, *free_list;
	GtkWidget       *new_prisoner;
	
	/* Fetch the currently selected list item which
	 * will be our next prisoner ;)
	 */
	dlist=GTK_LIST(gtklist)->selection;
	if (dlist)
		new_prisoner=GTK_WIDGET(dlist->data);
	else
		new_prisoner=NULL;
	
	/* Look for already imprisoned list items, we
	 * will put them back into the list.
	 * Remember to free the doubly linked list that
	 * gtk_container_children() returns
	 */
	dlist=gtk_container_children(GTK_CONTAINER(frame));
	free_list=dlist;
	while (dlist) {
	    GtkWidget       *list_item;
	    
	    list_item=dlist->data;
	    
	    gtk_widget_reparent(list_item, gtklist);
	    
	    dlist=dlist->next;
	}
	g_list_free(free_list);
	
	/* If we have a new prisoner, remove him from the
	 * List and put him into the frame "Prison".
	 * We need to unselect the item first.
	 */
	if (new_prisoner) {
	    GList   static_dlist;
	    
	    static_dlist.data=new_prisoner;
	    static_dlist.next=NULL;
	    static_dlist.prev=NULL;
	    
	    gtk_list_unselect_child(GTK_LIST(gtklist),
				    new_prisoner);
	    gtk_widget_reparent(new_prisoner, frame);
	}
    }
}
Exemple #9
0
gboolean
bst_choice_selectable (GtkWidget *widget)
{
  gboolean selectable = FALSE;
  
  g_return_val_if_fail (GTK_IS_CONTAINER (widget), FALSE);
  
  if (GTK_IS_MENU (widget))
    {
      GList *list, *children = gtk_container_children (GTK_CONTAINER (widget));
      
      for (list = children; list; list = list->next)
	{
	  GtkBin *bin = list->data;
	  
	  if (GTK_WIDGET_IS_SENSITIVE (bin) && GTK_WIDGET_VISIBLE (bin) && bin->child)
	    {
	      selectable = TRUE;
	      break;
	    }
	}
      g_list_free (children);
    }
  else if (GXK_IS_DIALOG (widget))
    {
      GList *list, *children = gtk_container_children (GTK_CONTAINER (GXK_DIALOG (widget)->hbox));
      
      for (list = children; list; list = list->next)
	{
	  GtkBin *bin = list->data;
	  
	  if (GTK_IS_BUTTON (bin) && GTK_WIDGET_IS_SENSITIVE (bin) && GTK_WIDGET_VISIBLE (bin))
	    {
	      selectable = TRUE;
	      break;
	    }
	}
      g_list_free (children);
    }
  
  return selectable;
}
Exemple #10
0
static size_t calculate_recovered_space(void)
{
    GtkWidget *widget;
    GList *list, *poopy, *clist;
    GtkWidget *button;
    component_list *component;
    gboolean ready;
    size_t size;

    ready = FALSE;
    size = 0;
    widget = glade_xml_get_widget(uninstall_glade, "uninstall_vbox");
    list = gtk_container_children(GTK_CONTAINER(widget));
    while ( list ) {
        widget = GTK_WIDGET(list->data);
        poopy = gtk_container_children(GTK_CONTAINER(widget));
        widget = GTK_WIDGET(poopy->data);
        clist = gtk_container_children(GTK_CONTAINER(widget));
        while ( clist ) {
            button = GTK_WIDGET(clist->data);
            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)) ) {
                component = gtk_object_get_data(GTK_OBJECT(button), "data");
                size += component->size / 1024;
                ready = TRUE;
            }
            clist = clist->next;
        }
        list = list->next;
    }
    widget = glade_xml_get_widget(uninstall_glade, "recovered_space_label");
    if ( widget ) {
        char text[128];
        sprintf(text, _("%d MB"), size/1024);
        gtk_label_set_text(GTK_LABEL(widget), text);
    }
    widget = glade_xml_get_widget(uninstall_glade, "uninstall_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, ready);
    }
    return(size);
}
Exemple #11
0
static void toggle_icon(GtkToggleButton *button, MimeView *mimeview)
{
	GList *child;
	
	child = gtk_container_children(GTK_CONTAINER(mimeview->icon_vbox));
	for (; child != NULL; child = g_list_next(child)) {
		if (GTK_IS_TOGGLE_BUTTON(child->data) && 
		    GTK_TOGGLE_BUTTON(child->data) != button &&
		    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(child->data)))
			gtk_toggle_button_set_active
				(GTK_TOGGLE_BUTTON(child->data),
				 FALSE);
	}
}
/*---------------------------------------------------------------------*/
void
bglk_gtk_container_remove_all( GtkContainer *c ) {
   GList *lst = gtk_container_children( c );
   obj_t res = BNIL;

   while( lst ) {
      GtkWidget *widget;
      obj_t obj;

      widget = GTK_WIDGET( lst->data );
      gtk_container_remove( c, widget );
      lst = lst->next;
   }
}
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
  (JNIEnv *env, jobject obj, jint index)
{
  void *ptr;
  GList *list;

  ptr = NSA_GET_PTR (env, obj);

  gdk_threads_enter ();
  list = gtk_container_children (GTK_CONTAINER (ptr));
  list = g_list_nth (list, index);
  gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
  gdk_threads_leave ();
}
Exemple #14
0
static void icon_list_clear (MimeView *mimeview)
{
	GList     *child;
	GtkAdjustment *adj;
	
	child = gtk_container_children(GTK_CONTAINER(mimeview->icon_vbox));
	for (; child != NULL; child = g_list_next(child)) {
		gtkut_container_remove(GTK_CONTAINER(mimeview->icon_vbox), 
				       GTK_WIDGET(child->data));
	}
	mimeview->icon_count = 0;
	adj  = gtk_layout_get_vadjustment(GTK_LAYOUT(mimeview->icon_scroll));
	adj->value = adj->lower;
	gtk_signal_emit_by_name(GTK_OBJECT (adj), "value_changed");
}
Exemple #15
0
static void icon_list_toggle_by_mime_info(MimeView	*mimeview,
					  MimeInfo	*mimeinfo)
{
	GList *child;
	
	child = gtk_container_children(GTK_CONTAINER(mimeview->icon_vbox));
	for (; child != NULL; child = g_list_next(child)) {
		if (GTK_IS_TOGGLE_BUTTON(child->data) &&  
		    gtk_object_get_data(GTK_OBJECT(child->data),
					"partinfo") == (gpointer)mimeinfo) {
			toggle_icon(GTK_TOGGLE_BUTTON(child->data), mimeview);
			gtk_toggle_button_set_active
				(GTK_TOGGLE_BUTTON(child->data), TRUE);
		}				 
	}
}
Exemple #16
0
/* {EV_NOTEBOOK_IMP}.set_item_text */
void F1106_14790 (EIF_REFERENCE Current, EIF_REFERENCE arg1, EIF_REFERENCE arg2)
{
	GTCX
	EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
	EIF_REFERENCE loc2 = (EIF_REFERENCE) 0;
	EIF_POINTER loc3 = (EIF_POINTER) 0;
	EIF_POINTER loc4 = (EIF_POINTER) 0;
	EIF_POINTER loc5 = (EIF_POINTER) 0;
	EIF_POINTER loc6 = (EIF_POINTER) 0;
	EIF_POINTER tp1;
	EIF_POINTER tp2;
	EIF_REFERENCE tr1 = NULL;
	RTLD;
	
	RTLI(6);
	RTLR(0,loc1);
	RTLR(1,arg1);
	RTLR(2,loc2);
	RTLR(3,tr1);
	RTLR(4,arg2);
	RTLR(5,Current);
	
	RTGC;
	loc1 = *(EIF_REFERENCE *)(RTCV(arg1) + O8345[Dtype(arg1)-929]);
	loc1 = RTRV(eif_non_attached_type(1095), loc1);
	RTCT0(NULL, EX_CHECK);
	if ((EIF_BOOLEAN)(loc1 != NULL)) {
		RTCK0;
	} else {
		RTCF0;
	}
	tr1 = RTLNS(780, 780, _OBJSIZ_0_1_0_1_0_1_0_0_);
	F781_7428(RTCV(tr1), arg2);
	loc2 = (EIF_REFERENCE) tr1;
	tp1 = *(EIF_POINTER *)(RTCV(loc1) + O10979[Dtype(loc1)-1078]);
	F1106_14788(Current, tp1);
	tp1 = F1079_14146(Current);
	tp2 = *(EIF_POINTER *)(RTCV(loc1) + O10979[Dtype(loc1)-1078]);
	loc3 = (EIF_POINTER) gtk_notebook_get_tab_label((GtkNotebook*) tp1, (GtkWidget*) tp2);
	loc4 = (EIF_POINTER) (((GtkBin *)loc3)->child);
	loc5 = (EIF_POINTER) gtk_container_children((GtkContainer*) loc4);
	loc6 = (EIF_POINTER) g_list_nth_data((GList*) loc5, (guint) ((EIF_INTEGER_32) 1L));
	tp1 = *(EIF_POINTER *)(RTCV(loc2)+ _PTROFF_0_1_0_1_0_0_);
	gtk_label_set_text((GtkLabel*) loc6, (gchar*) tp1);
	g_list_free((GList*) loc5);
	RTLE;
}
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectHooks
  (JNIEnv *env, jobject obj)
{
  void *ptr;
  GtkWidget *layout;

  ptr = NSA_GET_PTR (env, obj);

  gdk_threads_enter ();
  layout = GTK_WIDGET (gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child))->data);
  gtk_widget_realize (layout);
  connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
  
  gtk_widget_realize (GTK_WIDGET (ptr));
  connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
  gdk_threads_leave ();
}
Exemple #18
0
GtkLabel *get_label_from_button( GtkButton *btn )
{
	if( btn == NULL )
		return NULL;

	GList *ls = gtk_container_children( GTK_CONTAINER( btn ) );
	if( ls == NULL )
		return NULL;

	GList *p = g_list_nth( ls, 0 );
	if( p == NULL )
		return NULL;

	GtkLabel *label = GTK_LABEL( p->data );
	if( label == NULL )
		return NULL;

	return label;
}
JNIEXPORT jint JNICALL
Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
  (JNIEnv *env, jobject obj)
{
  void *ptr;
  GList *children;
  jint height = 0;

  ptr = NSA_GET_PTR (env, obj);

  gdk_threads_enter ();
  children = gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child));
  if (g_list_length (children) == 2)
    {
      GtkWidget *menubar = GTK_WIDGET (children->data);
      height = menubar->allocation.height;

    }
  gdk_threads_leave ();

  return height;
}
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMenu
  (JNIEnv *env, jobject obj, jobject menupeer)
{
  static void *helpmenu;
  void *mbar, *menu;
  GList *list;

  mbar = NSA_GET_PTR (env, obj);
  menu = NSA_GET_PTR (env, menupeer);

  gdk_threads_enter ();
  if (helpmenu != NULL)
    {
      list = gtk_container_children (GTK_CONTAINER (mbar));
      while (list != NULL && list->data != helpmenu)
        list = list->next;
      if (list != NULL && list->data == helpmenu)
        gtk_container_remove (GTK_CONTAINER (mbar), GTK_WIDGET (list->data));
    }
  helpmenu = menu;
  gdk_threads_leave ();
}
static void
choiceSelected (GtkMenuShell *menuShell, GChoicePeerData *data)
{
	jobject this = ((GComponentPeerData *)data)->peerGlobalRef;
	jobject target;
	JNIEnv *env;
	GtkWidget *active;
	GList *children;
	int index;
	
	if ((*JVM)->AttachCurrentThread (JVM, (void **) &env, NULL) != 0)
		return;
		
	awt_gtk_callbackEnter();
		
	active = gtk_menu_get_active (GTK_MENU(menuShell));
	children = gtk_container_children (GTK_CONTAINER(menuShell));
	index = g_list_index (children, (gpointer)active);
	
	if (index != -1)
	{
		GtkOptionMenu *optionMenu;
	
		target = (*env)->GetObjectField (env, this, GCachedIDs.GComponentPeer_targetFID);
		(*env)->SetIntField (env, target, GCachedIDs.java_awt_Choice_selectedIndexFID, (jint)index);
		(*env)->CallVoidMethod (env, this, GCachedIDs.GChoicePeer_postItemEventMID, (jint)index);

		/*
		** Workaround:
		** the popup is gone now, let's set the focus back to the optionMenu
		*/
		optionMenu = GTK_OPTION_MENU(((GComponentPeerData *)data)->widget);
		gtk_widget_grab_focus((GtkWidget *)optionMenu);
	}
	
	awt_gtk_callbackLeave();
}
Exemple #22
0
/*!
 *\brief        Used to 'click' the next or previous icon.
 *
 *\return       true if the icon 'number' exists and was selected.
 */
static gboolean icon_list_select_by_number(MimeView	*mimeview,
					   gint		 number)
{
	GList *child;

	if (number == 0) return FALSE;
	child = gtk_container_children(GTK_CONTAINER(mimeview->icon_vbox));
	for (; child != NULL; child = g_list_next(child)) {
		if (GTK_IS_TOGGLE_BUTTON(child->data) &&  
		    GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(child->data),
					"icon_number")) == number) {
			icon_selected(mimeview, number,
				      (MimeInfo*)gtk_object_get_data(GTK_OBJECT(child->data),
								     "partinfo"));
			toggle_icon(GTK_TOGGLE_BUTTON(child->data), mimeview);
			gtk_toggle_button_set_active
				(GTK_TOGGLE_BUTTON(child->data), TRUE);
			gtk_widget_grab_focus(GTK_WIDGET(child->data));
		
			return TRUE;
		}				 
	}
	return FALSE;
}
/*---------------------------------------------------------------------*/
obj_t
bglk_gtk_container_children( GtkContainer *c ) {
   GList *lst = gtk_container_children( c );
   obj_t res = BNIL;

   while( lst ) {
      GtkObject *data;
      GtkArg arg;
      obj_t obj;

      data = GTK_OBJECT( lst->data );
      arg.name = "user_data";
      gtk_object_arg_get( data, &arg, NULL );

      obj = (( arg.type == GTK_TYPE_POINTER ) ?
	     (obj_t)GTK_VALUE_POINTER( arg ) :
	     BUNSPEC);

      if( obj ) res = MAKE_PAIR( obj, res );
      lst = lst->next;
   }

   return res;
}
Exemple #24
0
/* {EV_NOTEBOOK_IMP}.set_item_pixmap */
void F1106_14791 (EIF_REFERENCE Current, EIF_REFERENCE arg1, EIF_REFERENCE arg2)
{
	GTCX
	EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
	EIF_POINTER loc2 = (EIF_POINTER) 0;
	EIF_POINTER loc3 = (EIF_POINTER) 0;
	EIF_POINTER loc4 = (EIF_POINTER) 0;
	EIF_POINTER loc5 = (EIF_POINTER) 0;
	EIF_POINTER loc6 = (EIF_POINTER) 0;
	EIF_REFERENCE loc7 = (EIF_REFERENCE) 0;
	EIF_POINTER tp1;
	EIF_POINTER tp2;
	RTLD;
	
	RTLI(5);
	RTLR(0,loc1);
	RTLR(1,arg1);
	RTLR(2,Current);
	RTLR(3,arg2);
	RTLR(4,loc7);
	
	RTGC;
	loc1 = *(EIF_REFERENCE *)(RTCV(arg1) + O8345[Dtype(arg1)-929]);
	loc1 = RTRV(eif_non_attached_type(1095), loc1);
	RTCT0(NULL, EX_CHECK);
	if ((EIF_BOOLEAN)(loc1 != NULL)) {
		RTCK0;
	} else {
		RTCF0;
	}
	tp1 = *(EIF_POINTER *)(RTCV(loc1) + O10979[Dtype(loc1)-1078]);
	F1106_14788(Current, tp1);
	tp1 = F1079_14146(Current);
	tp2 = *(EIF_POINTER *)(RTCV(loc1) + O10979[Dtype(loc1)-1078]);
	loc2 = (EIF_POINTER) gtk_notebook_get_tab_label((GtkNotebook*) tp1, (GtkWidget*) tp2);
	loc3 = (EIF_POINTER) (((GtkBin *)loc2)->child);
	loc5 = (EIF_POINTER) gtk_container_children((GtkContainer*) loc3);
	loc4 = (EIF_POINTER) g_list_nth_data((GList*) loc5, (guint) ((EIF_INTEGER_32) 0L));
	g_list_free((GList*) loc5);
	if ((EIF_BOOLEAN)(arg2 != NULL)) {
		loc7 = *(EIF_REFERENCE *)(RTCV(arg2) + _REFACS_3_);
		loc7 = RTRV(eif_non_attached_type(1201), loc7);
		RTCT0(NULL, EX_CHECK);
		if ((EIF_BOOLEAN)(loc7 != NULL)) {
			RTCK0;
		} else {
			RTCF0;
		}
		loc6 = F1198_17067(RTCV(loc7), *(EIF_INTEGER_32 *)(Current+ _LNGOFF_47_10_10_3_), *(EIF_INTEGER_32 *)(Current+ _LNGOFF_47_10_10_4_));
		gtk_image_set_from_pixbuf((GtkImage*) loc4, (GdkPixbuf*) loc6);
	} else {
		{
		/* INLINED CODE (default_pointer) */
		tp1 = (EIF_POINTER)  0;
		/* END INLINED CODE */
		}
		tp2 = tp1;
		gtk_image_set_from_pixbuf((GtkImage*) loc4, (GdkPixbuf*) tp2);
	}
	RTLE;
}
Exemple #25
0
void perform_uninstall_slot(GtkWidget* w, gpointer data)
{
    GtkWidget *notebook;
    GtkWidget *progress;
    GtkWidget *widget;
    GList *list, *poopy, *clist;
    GtkWidget *button;
    component_list *component;
    size_t size, total;
    char text[1024];
	const char *message;

	/* Set through environment to hide questions, and assume Yes */
	int show_messages;
	const char *env;

	show_messages = 1;

	env = getenv("SETUP_NO_PROMPT");
	if ( env && atoi(env) )
		show_messages = 0;


    /* First switch to the next notebook page */
    notebook = glade_xml_get_widget(uninstall_glade, "uninstall_notebook");
    gtk_notebook_set_page(GTK_NOTEBOOK(notebook), 1);
    widget = glade_xml_get_widget(uninstall_glade, "finished_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, FALSE);
    }

    /* Now uninstall all the selected components */
    progress = glade_xml_get_widget(uninstall_glade, "uninstall_progress");
    size = 0;
    total = calculate_recovered_space();
    widget = glade_xml_get_widget(uninstall_glade, "uninstall_vbox");
    list = gtk_container_children(GTK_CONTAINER(widget));
    while ( list && ! uninstall_cancelled ) {
        widget = GTK_WIDGET(list->data);
        poopy = gtk_container_children(GTK_CONTAINER(widget));
        widget = GTK_WIDGET(poopy->data);
        /* First do the addon components */
        clist = gtk_container_children(GTK_CONTAINER(widget));
        while ( clist && ! uninstall_cancelled ) {
            button = GTK_WIDGET(clist->data);
            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)) ) {
                component = gtk_object_get_data(GTK_OBJECT(button), "data");
                if ( loki_isdefault_component(component->component) ) {
                    clist = clist->next;
                    continue;
                }
                /* Put up the status */
                snprintf(text, sizeof(text), "%s: %s",
                        component->info->description,
                        loki_getname_component(component->component));
                set_status_text(text);

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }
				
				/* Display an optional message to the user */
				message = loki_getmessage_component(component->component);
				if (show_messages && message && !display_message(message, BUTTON_OK|BUTTON_ABORT) ) {
                    clist = clist->next;
					uninstall_cancelled = 1;
					break;
				}

                /* Remove the component */
                if ( ! uninstall_component(component->component, component->info) ) {
					uninstall_cancelled = 2;
					snprintf(text, sizeof(text), _("Uninstallation of component %s has failed!\n"
												   "The whole uninstallation may be incomplete.\n"),
							 loki_getname_component(component->component));
					display_message(text, BUTTON_ABORT);
					break;
				}

                /* Update the progress bar */
                if ( total && progress ) {
                    size += component->size/1024;
                    gtk_progress_set_percentage(GTK_PROGRESS(progress),
                                                (float)size/total);
                }
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }
            }
            clist = clist->next;
        }
        /* Now do the primary components */
        clist = gtk_container_children(GTK_CONTAINER(widget));
        while ( clist && ! uninstall_cancelled ) {
            button = GTK_WIDGET(clist->data);
            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)) ) {
                component = gtk_object_get_data(GTK_OBJECT(button), "data");
                if ( ! loki_isdefault_component(component->component) ) {
                    clist = clist->next;
                    continue;
                }
                /* Put up the status */
                strncpy(text, component->info->description, sizeof(text));
                set_status_text(text);

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }

				/* Display an optional message to the user */
				message = loki_getmessage_component(component->component);
				if ( message && !display_message(message, BUTTON_OK|BUTTON_ABORT) ) {
                    clist = clist->next;
					uninstall_cancelled = 1;
					break;
				}

                /* Remove the component */
                if ( ! perform_uninstall(component->product, component->info, 0) ) {
					uninstall_cancelled = 2;
					snprintf(text, sizeof(text), _("Uninstallation of product %s has failed!\n"
												   "Aborting the rest of the uninstallation.\n"),
							 component->info->description);
					display_message(text, BUTTON_ABORT);
					break;
				}
                remove_product(component->product);

                /* Update the progress bar */
                if ( total && progress ) {
                    size += component->size/1024;
                    gtk_progress_set_percentage(GTK_PROGRESS(progress),
                                                (float)size/total);
                }

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }
                break;
            }
            clist = clist->next;
        }
        list = list->next;
    }
    switch ( uninstall_cancelled ) {
	case 1:
        set_status_text(_("Uninstall cancelled"));
		break;
	case 2:
        set_status_text(_("Uninstall aborted"));
		break;
	default:
        set_status_text(_("Uninstall complete"));
		gtk_progress_set_percentage(GTK_PROGRESS(progress), 1.0f);
		break;
    }
    widget = glade_xml_get_widget(uninstall_glade, "cancel_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, FALSE);
    }
    widget = glade_xml_get_widget(uninstall_glade, "finished_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, TRUE);
    }
}
Exemple #26
0
/* {EV_NOTEBOOK_IMP}.item_pixmap */
EIF_REFERENCE F1106_14780 (EIF_REFERENCE Current, EIF_REFERENCE arg1)
{
	GTCX
	EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
	EIF_POINTER loc2 = (EIF_POINTER) 0;
	EIF_POINTER loc3 = (EIF_POINTER) 0;
	EIF_POINTER loc4 = (EIF_POINTER) 0;
	EIF_POINTER loc5 = (EIF_POINTER) 0;
	EIF_POINTER loc6 = (EIF_POINTER) 0;
	EIF_REFERENCE loc7 = (EIF_REFERENCE) 0;
	EIF_POINTER tp1;
	EIF_POINTER tp2;
	EIF_REFERENCE tr1 = NULL;
	EIF_REFERENCE Result = ((EIF_REFERENCE) 0);
	
	RTLD;
	
	RTLI(6);
	RTLR(0,loc1);
	RTLR(1,arg1);
	RTLR(2,Current);
	RTLR(3,tr1);
	RTLR(4,Result);
	RTLR(5,loc7);
	
	RTGC;
	loc1 = *(EIF_REFERENCE *)(RTCV(arg1) + O8345[Dtype(arg1)-929]);
	loc1 = RTRV(eif_non_attached_type(1095), loc1);
	RTCT0(NULL, EX_CHECK);
	if ((EIF_BOOLEAN)(loc1 != NULL)) {
		RTCK0;
	} else {
		RTCF0;
	}
	tp1 = F1079_14146(Current);
	tp2 = *(EIF_POINTER *)(RTCV(loc1) + O10979[Dtype(loc1)-1078]);
	loc2 = (EIF_POINTER) gtk_notebook_get_tab_label((GtkNotebook*) tp1, (GtkWidget*) tp2);
	{
	/* INLINED CODE (default_pointer) */
	tp1 = (EIF_POINTER)  0;
	/* END INLINED CODE */
	}
	if ((EIF_BOOLEAN)(loc2 != tp1)) {
		loc3 = (EIF_POINTER) (((GtkBin *)loc2)->child);
		loc4 = (EIF_POINTER) gtk_container_children((GtkContainer*) loc3);
		loc5 = (EIF_POINTER) g_list_nth_data((GList*) loc4, (guint) ((EIF_INTEGER_32) 0L));
		g_list_free((GList*) loc4);
		loc6 = (EIF_POINTER) gtk_image_get_pixbuf((GtkImage*) loc5);
		{
		/* INLINED CODE (default_pointer) */
		tp1 = (EIF_POINTER)  0;
		/* END INLINED CODE */
		}
		if ((EIF_BOOLEAN)(loc6 != tp1)) {
			tr1 = RTLNS(989, 989, _OBJSIZ_6_3_0_1_0_0_0_0_);
			F930_10736(RTCV(tr1));
			Result = (EIF_REFERENCE) tr1;
			loc7 = *(EIF_REFERENCE *)(RTCV(Result) + _REFACS_3_);
			loc7 = RTRV(eif_non_attached_type(1201), loc7);
			RTCT0(NULL, EX_CHECK);
			if ((EIF_BOOLEAN)(loc7 != NULL)) {
				RTCK0;
			} else {
				RTCF0;
			}
			F1202_17209(RTCV(loc7), loc6);
		}
	}
	RTLE;
	return Result;
}
Exemple #27
0
/* {EV_NOTEBOOK_IMP}.item_text */
EIF_REFERENCE F1106_14779 (EIF_REFERENCE Current, EIF_REFERENCE arg1)
{
	GTCX
	EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
	EIF_POINTER loc2 = (EIF_POINTER) 0;
	EIF_POINTER loc3 = (EIF_POINTER) 0;
	EIF_POINTER loc4 = (EIF_POINTER) 0;
	EIF_POINTER loc5 = (EIF_POINTER) 0;
	EIF_REFERENCE loc6 = (EIF_REFERENCE) 0;
	EIF_POINTER tp1;
	EIF_POINTER tp2;
	EIF_REFERENCE tr1 = NULL;
	RTLD;
	
	RTLI(5);
	RTLR(0,loc1);
	RTLR(1,arg1);
	RTLR(2,Current);
	RTLR(3,loc6);
	RTLR(4,tr1);
	
	RTGC;
	loc1 = *(EIF_REFERENCE *)(RTCV(arg1) + O8345[Dtype(arg1)-929]);
	loc1 = RTRV(eif_non_attached_type(1095), loc1);
	RTCT0(NULL, EX_CHECK);
	if ((EIF_BOOLEAN)(loc1 != NULL)) {
		RTCK0;
	} else {
		RTCF0;
	}
	tp1 = F1079_14146(Current);
	tp2 = *(EIF_POINTER *)(RTCV(loc1) + O10979[Dtype(loc1)-1078]);
	loc2 = (EIF_POINTER) gtk_notebook_get_tab_label((GtkNotebook*) tp1, (GtkWidget*) tp2);
	{
	/* INLINED CODE (default_pointer) */
	tp1 = (EIF_POINTER)  0;
	/* END INLINED CODE */
	}
	if ((EIF_BOOLEAN)(loc2 != tp1)) {
		loc3 = (EIF_POINTER) (((GtkBin *)loc2)->child);
		loc4 = (EIF_POINTER) gtk_container_children((GtkContainer*) loc3);
		loc5 = (EIF_POINTER) g_list_nth_data((GList*) loc4, (guint) ((EIF_INTEGER_32) 1L));
		g_list_free((GList*) loc4);
	}
	{
	/* INLINED CODE (default_pointer) */
	tp1 = (EIF_POINTER)  0;
	/* END INLINED CODE */
	}
	if ((EIF_BOOLEAN)(loc5 != tp1)) {
		tr1 = RTLNS(780, 780, _OBJSIZ_0_1_0_1_0_1_0_0_);
		tp1 = (EIF_POINTER) (((GtkLabel *)loc5)->label);
		F781_7430(RTCV(tr1), tp1);
		loc6 = (EIF_REFERENCE) tr1;
		tr1 = F781_7426(RTCV(loc6));
		RTLE;
		return (EIF_REFERENCE) tr1;
	} else {
		tr1 = RTLNS(925, 925, _OBJSIZ_1_1_0_3_0_0_0_0_);
		F920_10235(RTCV(tr1));
		RTLE;
		return (EIF_REFERENCE) tr1;
	}/* NOTREACHED */
	
}
Exemple #28
0
bool wxNotebook::SetPageImage( size_t page, int image )
{
    /* HvdH 28-12-98: now it works, but it's a bit of a kludge */

    wxGtkNotebookPage* nb_page = GetNotebookPage(page);

    if (!nb_page) return FALSE;

    /* Optimization posibility: return immediately if image unchanged.
     * Not enabled because it may break existing (stupid) code that
     * manipulates the imagelist to cycle images */

    /* if (image == nb_page->m_image) return true; */

    /* For different cases:
       1) no image -> no image
       2) image -> no image
       3) no image -> image
       4) image -> image */

    if (image == -1 && nb_page->m_image == -1)
        return true; /* Case 1): Nothing to do. */

    GtkWidget *pixmapwid = NULL;

    if (nb_page->m_image != -1)
    {
        /* Case 2) or 4). There is already an image in the gtkhbox. Let's find it */

        GList *child = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
        while (child)
        {
            if (GTK_IS_PIXMAP(child->data))
            {
                pixmapwid = GTK_WIDGET(child->data);
                break;
            }
            child = child->next;
        }

        /* We should have the pixmap widget now */
        wxASSERT(pixmapwid != NULL);

        if (image == -1)
        {
            /* If there's no new widget, just remove the old from the box */
            gtk_container_remove(GTK_CONTAINER(nb_page->m_box), pixmapwid);
            nb_page->m_image = -1;

            return true; /* Case 2) */
        }
    }

    /* Only cases 3) and 4) left */
    wxASSERT( m_imageList != NULL ); /* Just in case */

    /* Construct the new pixmap */
    const wxBitmap *bmp = m_imageList->GetBitmapPtr(image);
    GdkPixmap *pixmap = bmp->GetPixmap();
    GdkBitmap *mask = NULL;
    if ( bmp->GetMask() )
    {
        mask = bmp->GetMask()->GetBitmap();
    }

    if (pixmapwid == NULL)
    {
        /* Case 3) No old pixmap. Create a new one and prepend it to the hbox */
        pixmapwid = gtk_pixmap_new (pixmap, mask );

        /* CHECKME: Are these pack flags okay? */
        gtk_box_pack_start(GTK_BOX(nb_page->m_box), pixmapwid, FALSE, FALSE, m_padding);
        gtk_widget_show(pixmapwid);
    }
    else
    {
        /* Case 4) Simply replace the pixmap */
        gtk_pixmap_set(GTK_PIXMAP(pixmapwid), pixmap, mask);
    }

    nb_page->m_image = image;

    return true;
}
Exemple #29
0
int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
{
    const gint x = m_widget->allocation.x;
    const gint y = m_widget->allocation.y;

    const size_t count = GetPageCount();
    size_t i = 0;

    // MR: Code to fix HitTest index return when tabs are scrolled.
    // No idea if it would work for GTK1
#if 0
    GtkNotebook * notebook = GTK_NOTEBOOK(m_widget);
    if (gtk_notebook_get_scrollable(notebook));
        i = g_list_position( notebook->children, notebook->first_tab );
#endif

    for ( ; i < count; i++ )
    {
        wxGtkNotebookPage* nb_page = GetNotebookPage(i);
        GtkWidget *box = nb_page->m_box;

        // VZ: don't know how to find the border width in GTK+ 1.2
        const gint border = 0;
        if ( IsPointInsideWidget(pt, box, x, y, border) )
        {
            // ok, we're inside this tab -- now find out where, if needed
            if ( flags )
            {
                GtkWidget *pixmap = NULL;

                GList *children = gtk_container_children(GTK_CONTAINER(box));
                for ( GList *child = children; child; child = child->next )
                {
                    if ( GTK_IS_PIXMAP(child->data) )
                    {
                        pixmap = GTK_WIDGET(child->data);
                        break;
                    }
                }

                if ( children )
                    g_list_free(children);

                if ( pixmap && IsPointInsideWidget(pt, pixmap, x, y) )
                {
                    *flags = wxBK_HITTEST_ONICON;
                }
                else if ( IsPointInsideWidget(pt, GTK_WIDGET(nb_page->m_label), x, y) )
                {
                    *flags = wxBK_HITTEST_ONLABEL;
                }
                else
                {
                    *flags = wxBK_HITTEST_ONITEM;
                }
            }

            return i;
        }
    }

    if ( flags )
        *flags = wxBK_HITTEST_NOWHERE;

    return wxNOT_FOUND;
}
Exemple #30
0
void FillBSPMenu(){
	GtkWidget *item, *menu; // menu points to a GtkMenu (not an item)
	epair_t *ep;
	GList *lst;
	int i;

	menu = GTK_WIDGET( g_object_get_data( G_OBJECT( g_qeglobals_gui.d_main_window ), "menu_bsp" ) );

	while ( ( lst = gtk_container_children( GTK_CONTAINER( menu ) ) ) != NULL )
		gtk_container_remove( GTK_CONTAINER( menu ), GTK_WIDGET( lst->data ) );

	if ( g_PrefsDlg.m_bDetachableMenus ) {
		item = gtk_tearoff_menu_item_new();
		gtk_menu_append( GTK_MENU( menu ), item );
		gtk_widget_set_sensitive( item, TRUE );
		gtk_widget_show( item );
	}

	if ( g_qeglobals.bBSPFrontendPlugin ) {
		CString str = g_BSPFrontendTable.m_pfnGetBSPMenu();
		char cTemp[1024];
		strcpy( cTemp, str );
		char* token = strtok( cTemp, ",;" );
		if ( token && *token == ' ' ) {
			while ( *token == ' ' )
				token++;
		}
		i = 0;

		// first token is menu name
		item = gtk_menu_get_attach_widget( GTK_MENU( menu ) );
		gtk_label_set_text( GTK_LABEL( GTK_BIN( item )->child ), token );

		token = strtok( NULL, ",;" );
		while ( token != NULL )
		{
			g_BSPFrontendCommands = g_slist_append( g_BSPFrontendCommands, g_strdup( token ) );
			item = gtk_menu_item_new_with_label( token );
			gtk_widget_show( item );
			gtk_container_add( GTK_CONTAINER( menu ), item );
			gtk_signal_connect( GTK_OBJECT( item ), "activate",
								GTK_SIGNAL_FUNC( HandleCommand ), GINT_TO_POINTER( CMD_BSPCOMMAND + i ) );
			token = strtok( NULL, ",;" );
			i++;
		}
	}
	else
	{
		i = 0;
		for ( ep = g_qeglobals.d_project_entity->epairs; ep; ep = ep->next )
		{
			if ( strncmp( ep->key, "bsp_", 4 ) == 0 ) {
				bsp_commands[i] = ep->key;
				item = gtk_menu_item_new_with_label( ep->key + 4 );
				gtk_widget_show( item );
				gtk_container_add( GTK_CONTAINER( menu ), item );
				gtk_signal_connect( GTK_OBJECT( item ), "activate",
									GTK_SIGNAL_FUNC( HandleCommand ), GINT_TO_POINTER( CMD_BSPCOMMAND + i ) );
				i++;
			}
		}
	}
}